public ActionResult Edit([Bind(Include = "ID,Name,IsActive,IsDeleted")] CityTypeEntity cityTypeEntity) { if (ModelState.IsValid) { // cityTypeService.Entry(cityTypeEntity).State = EntityState.Modified; CityTypeEntity cityTypeEntityOLD = cityTypeService.GetById(cityTypeEntity.ID); cityTypeEntityOLD.UpdatedByID = User.Identity.GetUserId(); cityTypeEntityOLD.UpdatedDate = DateTime.Now; cityTypeEntityOLD.IsActive = cityTypeEntity.IsActive; cityTypeEntityOLD.Name = cityTypeEntity.Name; cityTypeService.Update(cityTypeEntityOLD); cityTypeService.Save(); return(RedirectToAction("Index")); } return(View(cityTypeEntity)); }
public ActionResult Edit([Bind(Include = "ID,Name,CreatedDate,UpdatedDate,IsActive,IsDeleted,CityTypeID,CreatedByID,UpdatedByID")] CityEntity cityEntity) { if (ModelState.IsValid) { // cityService.Entry(cityEntity).State = EntityState.Modified; CityEntity cityEntityOLD = cityService.GetById(cityEntity.ID); cityEntityOLD.UpdatedByID = User.Identity.GetUserId(); cityEntityOLD.UpdatedDate = DateTime.Now; cityEntityOLD.IsActive = cityEntity.IsActive; cityEntityOLD.Name = cityEntity.Name; cityEntity.UpdatedByID = User.Identity.GetUserId(); cityEntity.UpdatedDate = DateTime.Now; cityService.Update(cityEntityOLD); cityService.Save(); return(RedirectToAction("Index")); } ViewBag.CityTypeID = new SelectList(cityTypeService.GetMany(e => e.IsActive == true && e.IsDeleted == false), "ID", "Name"); return(View(cityEntity)); }