Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
how to check already existing record in mvc
Mark Tabor
Jan 14 2018 5:28 AM
134
Reply
I am new to mvc and i am creating application with built in read/write controller and views using entity framework , below is my create customer controller now i want to check the unique mobile number i mean mobile number for each customer should be unique , how to check that below is my controller code.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "Cutomer_ID,Customer_Name,Phone,Location,Email,gender")] Customer customer, string BtnPrevious, string BtnNext)
{
// bool isexists = db.customers.Any(x => x.ContactId == _customer.ContactId)
if (ModelState.IsValid)
{
//bool contactExists = db.Customers.Any(contact => contact.Customer_Name.Equals());
db.Customers.Add(customer);
db.SaveChanges();
// return View("~/Views/Orders/Details.cshtml");
// return RedirectToAction("~/Views/Shirts/Index.cshtml");
}
return View(customer);
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
date wise filter record in gridview in asp.net
Telerik RadGrid