Example #1
0
        public ActionResult Update(int id, Input.CategoryUpdateModel model)
        {
            if (!_service.Update(id, model))
            {
                return(NotFound());
            }

            return(NoContent());
        }
        public bool Update(int id, Input.CategoryUpdateModel category)
        {
            var foundCategory = _repository.LookupCategory(id);

            if (foundCategory == null)
            {
                return(false);
            }

            _mapper.Map(category, foundCategory);
            _repository.Update(foundCategory);
            _repository.SaveChanges();

            return(true);
        }