public ActionResult Create(Causale oCausale) { if (oCausale == null) oCausale = new Causale(); return View(oCausale); }
public ActionResult Edit(Causale oCausale) { //if (oCausale == null) // oCausale = new Causale(); //else Causale model =_oCausaleRepo.GetEdit().SingleOrDefault(x => x.ID == oCausale.ID); return View(model); }
public ActionResult Delete(Causale model) { if (model != null && ModelState.IsValid) { // Aggiorno l'operazione Causale oCausale = _oCausaleRepo.GetEdit().SingleOrDefault(x => x.ID == model.ID); if (oCausale != null) _oCausaleRepo.Delete(oCausale); this.DatabaseFactory.GetContext().SaveChanges(); return RedirectToAction("Index"); } return RedirectToAction("Index"); }
public ActionResult Insert(Causale oCausale) { if (ModelState.IsValid) { try { _oCausaleRepo.Add(oCausale); this.DatabaseFactory.GetContext().SaveChanges(); return RedirectToAction("Index"); //return View("Index"); } catch (Exception) { return RedirectToAction("Create", oCausale); //return View("Create", oCausale); } } //return View("Create", oCausale); return RedirectToAction("Create", oCausale); }
public void Update(Causale oCausale) { _db.Remove(oCausale); _db.Add(oCausale); }
public void Delete(Causale oCausale) { _db.Remove(oCausale); }
public void Add(Causale oCausale) { _db.Add(oCausale); }