Пример #1
0
        public ActionResult Update(TicketCategory ticketCategory)
        {
            ApiResult <TicketCategory> apiResult;

            if (ModelState.IsValid)
            {
                if (ticketCategory.Id > 0)
                {
                    apiResult = TryExecute(() =>
                    {
                        _ticketCategoryRepository.Update(ticketCategory);
                        _unitOfWork.Commit();
                        return(ticketCategory);
                    }, "Ticket Category updated sucessfully");
                }
                else
                {
                    apiResult = TryExecute(() =>
                    {
                        _ticketCategoryRepository.Create(ticketCategory);
                        _unitOfWork.Commit();
                        return(ticketCategory);
                    }, "Ticket Category created sucessfully");
                }
            }
            else
            {
                apiResult = ApiResultFromModelErrors <TicketCategory>();
            }

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public void Update(UpdateTicketCategoryCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            TicketCategory ticketCategory = new TicketCategory(command.CategoryId, command.Name);

            if (NotifyNullCategory(ticketCategory))
            {
                return;
            }

            _repository.Update(ticketCategory);

            Commit();
        }
Пример #3
0
 public TicketCategory updateCategory(TicketCategory category)
 {
     categoryRepo.Update(category);
     return(category);
 }