Пример #1
0
        public ActionResult Update(int id)
        {
            UpCategory model =
                _uow
                .GetRepo <UpCategory>()
                .Where(x => x.Id == id)
                .FirstOrDefault();

            return(View(model));
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }
Пример #4
0
 private ValidationResult ModelValidate(UpCategory model)
 {
     return(_f.Create <UpCategoryValidator, UpCategory>(model));
 }