public ActionResult Edit(MasterArea model) { if (ModelState.IsValid) { Context.MasterArea dbitem = RepoArea.FindByPK(model.Id); model.setDb(dbitem); RepoArea.save(dbitem); return(RedirectToAction("Index")); } LocationArea[] result = JsonConvert.DeserializeObject <LocationArea[]>(model.strArea); model.listArea = result.ToList(); return(View("Form", model)); }
public ActionResult Add(MasterArea model) { if (ModelState.IsValid) { Context.MasterArea dbitem = new Context.MasterArea(); model.setDb(dbitem); //generate code dbitem.Urutan = RepoArea.getUrutan() + 1; dbitem.Kode = RepoArea.generateCode(dbitem.Urutan); RepoArea.save(dbitem); return(RedirectToAction("Index")); } LocationArea[] result = JsonConvert.DeserializeObject <LocationArea[]>(model.strArea); model.listArea = result.ToList(); return(View("Form", model)); }