TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Tabor
589
2k
460.1k
how to check already existing record in mvc
Jan 14 2018 5:28 AM
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);
}
Reply
Answers (
1
)
date wise filter record in gridview in asp.net
Telerik RadGrid