How to check if a value already exists in database
I would like to check if notificationStartDate and notificationEndDate already exist in the database. So I don't create 2 fields with the same notificationStart Date and notificationEndDate.
public ActionResult Create(
[Bind(Include = "notificationID,notificationName,notificationText,
notificationStartDate,notificationEndDate,notificationEnabledDisabled")]
tbl_notification tbl_notification)
{
if (ModelState.IsValid)
{
db.tbl_notification.Add(tbl_notification);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(tbl_notification);
}