public ActionResult Create(string reasonName, string isAdjust) { try { if (!string.IsNullOrEmpty(reasonName)) { ReasonOntime reasonOntime = new ReasonOntime(); reasonOntime.Name = reasonName; reasonOntime.IsDeleted = false; if (isAdjust == "True") { reasonOntime.IsAdjust = true; } if (ModelState.IsValid) { objBs.reasonOntimeBs.Insert(reasonOntime); } return(RedirectToAction("Index", new { sms = "Created Successfully !" })); } else { return(RedirectToAction("Index", new { sms = "reason is null or empty !" })); } } catch (Exception ex) { return(RedirectToAction("Index", new { sms = "Operation Create failed ! " + ex.InnerException.InnerException.Message.ToString() })); } }
//Delete public void Delete(int Id) { ReasonOntime reasonOntime = db.ReasonOntimes.Find(Id); reasonOntime.IsDeleted = true; db.Entry(reasonOntime).State = EntityState.Modified; Save(); }
public ActionResult Create(string reasonName, string isAdjust) { try { if (!string.IsNullOrEmpty(reasonName)) { ReasonOntime reasonOntime = new ReasonOntime(); reasonOntime.Name = reasonName; reasonOntime.IsDeleted = false; if (isAdjust == "True") reasonOntime.IsAdjust = true; if (ModelState.IsValid) { objBs.reasonOntimeBs.Insert(reasonOntime); } return RedirectToAction("Index", new { sms = "Created Successfully !" }); } else { return RedirectToAction("Index", new { sms = "reason is null or empty !" }); } } catch (Exception ex) { return RedirectToAction("Index", new { sms = "Operation Create failed ! " + ex.InnerException.InnerException.Message.ToString() }); } }
//Update public void Update(ReasonOntime reasonOntime) { db.Entry(reasonOntime).State = EntityState.Modified; Save(); }
//Insert public void Insert(ReasonOntime reasonOntime) { db.ReasonOntimes.Add(reasonOntime); Save(); }
//Update public void Update(ReasonOntime reasonOntime) { objDb.Update(reasonOntime); }
//Insert public void Insert(ReasonOntime reasonOntime) { objDb.Insert(reasonOntime); }