public void GetEditViewTest()
        {
            var model = _applicationDbContext.Types.First();

            TypesUpdateModel updateModel = _typesService.GetEditView(model.ID);

            Assert.IsNotNull(updateModel);
        }
Exemple #2
0
        public void Update(int id, TypesUpdateModel type)
        {
            var _type = _typesRepository.Get(id);

            if (_type == null)
            {
                throw new ApplicationException("Błąd, blad edycji");
            }

            _type.Update(type);

            if (!_typesRepository.Update(_type))
            {
                throw new ApplicationException();
            }
        }
        public ActionResult Edit(int id, TypesUpdateModel typesUpdate)
        {
            if (!ModelState.IsValid)
            {
                return(View(typesUpdate));
            }

            try
            {
                _typesService.Update(id, typesUpdate);
            }
            catch (Exception e)
            {
                return(new HttpStatusCodeResult(500, e.Message));
            }

            return(RedirectToAction("Index"));
        }
Exemple #4
0
 public void Update(TypesUpdateModel typesCreate)
 {
     Description = typesCreate.Description;
 }