public ActionResult Edit(Rute model) { if (ModelState.IsValid) { Context.Rute dbitem = RepoRute.FindByPK(model.Id); model.setDb(dbitem); RepoRute.save(dbitem); return(RedirectToAction("Index")); } return(View("Form", model)); }
public ActionResult Add(Rute model, string submitBasicData) { if (ModelState.IsValid) { Context.Rute dbitem = new Context.Rute(); model.setDb(dbitem); //generate code dbitem.Urutan = RepoRute.getUrutan() + 1; dbitem.Kode = RepoRute.generateCode(dbitem.Urutan); RepoRute.save(dbitem); return(RedirectToAction("Index")); } return(View("Form", model)); }