Exemplo n.º 1
0
        public void UpdateStuffCategory(StuffCategory stuffCategory)
        {
            if (CategoryExists(stuffCategory))
                throw new ObjectExistsException<StuffCategory>();

            _stuffCategoryRepository.Update(stuffCategory);
            _unitOfWork.Save();
        }
Exemplo n.º 2
0
 public JsonResult CreateStuffCategory(StuffCategory stuffCategory)
 {
     try
     {
         _stuffCategoryService.CreateStuffCategory(stuffCategory);
         var stuffCateg = _stuffCategoryService.FindStuffCategoryByName(stuffCategory.Name);
         return Json(new { StuffCategory = stuffCateg });
     }
     catch (ObjectExistsException<StuffCategory> ex)
     {
         return Json(new {Error = ex.Message});
     }
 }
Exemplo n.º 3
0
 private bool CategoryExists(StuffCategory stuffCategory)
 {
     return FindStuffCategoryByName(stuffCategory.Name) != null;
 }