public ActionResult Create(UnitViewModel model)
 {
     if (ModelState.IsValid)
     {
         db.Units.Add(new Unit
         {
             UnitName = model.UnitName,
             IsDeleted = model.IsDeleted
         });
         db.SaveChanges();
         ModelState.Clear();
         return View(new UnitViewModel());
     }
     return View(model);
 }
 public ActionResult Edit(UnitViewModel model)
 {
     if (ModelState.IsValid)
     {
         var search = db.Units.Where(x=>x.UnitId==model.UnitId).FirstOrDefault();
         if (search!=null)
         {
             search.UnitName = model.UnitName;
             search.IsDeleted = model.IsDeleted;
             db.SaveChanges();
             ModelState.Clear();
             return RedirectToAction("Index");
         }
     }
     return View(model);
 }