public void UpdateStuffCategory(StuffCategory stuffCategory)
        {
            if (CategoryExists(stuffCategory))
                throw new ObjectExistsException<StuffCategory>();

            _stuffCategoryRepository.Update(stuffCategory);
            _unitOfWork.Save();
        }
Esempio 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});
     }
 }
 private bool CategoryExists(StuffCategory stuffCategory)
 {
     return FindStuffCategoryByName(stuffCategory.Name) != null;
 }