public ActionResult Create(Cities model) { try { var cObj = new Cities() { City = model.City }; db.tabCities.Add(cObj); db.SaveChanges(); return PartialView("Create"); } catch (Exception ex) { throw ex; } }
public ActionResult Edit(Cities model) { if (ModelState.IsValid) { Cities cObj = db.tabCities.Find(model.CityId); cObj.City = model.City; db.Entry(cObj).State = EntityState.Modified; db.SaveChanges(); return PartialView("Create"); } return View(); }