Exemplo n.º 1
0
 public ActionResult EditDistrict(District district)
 {
     var ds = db.Districts.Find(district.DistrictID);
     if (ds != null)
     {
         ds.DistrictName = district.DistrictName;
         ds.Description = district.Description;
         ds.UpdatedBy = User.Identity.Name;
         ds.UpdatedDate = DateTime.Now;
         db.Entry(ds).State = System.Data.EntityState.Modified;
         db.SaveChanges();
         return null;
     }
     return View();
 }
Exemplo n.º 2
0
 public ActionResult CreateDistrict(District district)
 {
     if (ModelState.IsValid)
     {
         district.CreatedBy = User.Identity.Name;
         district.CreatedDate = DateTime.Now;
         district.UpdatedBy = User.Identity.Name;
         district.UpdatedDate = DateTime.Now;
         district.IsDelete = false;
         db.Entry(district).State = System.Data.EntityState.Added;
         db.SaveChanges();
         return RedirectToAction("ListDistricts");
     }
     return View(district);
 }