public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HRMS_SALUTATION hRMS_SALUTATION = db.HRMS_SALUTATION.Find(id); if (hRMS_SALUTATION == null) { return(HttpNotFound()); } return(View(hRMS_SALUTATION)); }
public bool delete(long id) { HRMS_SALUTATION hRMS_SALUTATION = db.HRMS_SALUTATION.Find(id); if (hRMS_SALUTATION != null) { db.HRMS_SALUTATION.Remove(hRMS_SALUTATION); db.SaveChanges(); return(true); } else { return(false); } }
public ActionResult Edit([Bind(Include = "Salutation_ID,Salutation_Name")] HRMS_SALUTATION hRMS_SALUTATION) { if (ModelState.IsValid) { var salutationName = db.HRMS_SALUTATION.FirstOrDefault(rec => rec.Salutation_Name == hRMS_SALUTATION.Salutation_Name); if (salutationName == null) { db.Entry(hRMS_SALUTATION).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.Salutation_Status = "It is already exist!"; return(View()); } } return(View(hRMS_SALUTATION)); }
public ActionResult Create([Bind(Include = "Salutation_ID,Salutation_Name")] HRMS_SALUTATION hRMS_SALUTATION) { if (ModelState.IsValid) { var salutationName = db.HRMS_SALUTATION.FirstOrDefault(rec => rec.Salutation_Name == hRMS_SALUTATION.Salutation_Name); if (salutationName == null) { db.HRMS_SALUTATION.Add(hRMS_SALUTATION); db.SaveChanges(); ViewBag.Salutation_Status = "It is Created successfully!"; return(View()); } else { ViewBag.Salutation_Status = "It is already exist!"; return(View()); } } return(View(hRMS_SALUTATION)); }