public ActionResult Update(int id) { UpCategory model = _uow .GetRepo <UpCategory>() .Where(x => x.Id == id) .FirstOrDefault(); return(View(model)); }
public ActionResult Add(UpCategory model) { if (ModelValidate(model).IsValid) { _uow.GetRepo <UpCategory>().Add(model); if (_uow.Commit() > 0) { TempData["Msg"] = "İşlem başarıyla gerçekleşmiştir."; } ModelState.Clear(); } else { _collect.CollectError <UpCategoryValidator, UpCategory>(model); } return(View()); }
public ActionResult Update(UpCategory model) { if (ModelValidate(model).IsValid) { _uow .GetRepo <UpCategory>() .Update(model); if (_uow.Commit() > 0) { TempData["Msg"] = "Başarıyla güncellenmiştir."; } } else { _collect.CollectError <UpCategoryValidator, UpCategory>(model); } return(View()); }
private ValidationResult ModelValidate(UpCategory model) { return(_f.Create <UpCategoryValidator, UpCategory>(model)); }