//[Authorize(Roles = "SupportAccount,AdminAccount")] public IActionResult Update(Guid id, [FromBody] UpdateTicketCategoryCommand command) { command.CategoryId = id; _ticketCategoryApplicationService.Update(command); return(CreateResponse()); }
public void ShouldUpdateTicketCategory() { PopulateRepository(); UpdateTicketCategoryCommand command = new UpdateTicketCategoryCommand() { CategoryId = idOne, Name = "Problemas de na criação de ordens" }; appService.Update(command); TicketCategory category = appService.GetById(idOne); Assert.AreEqual("Problemas de na criação de ordens", category.Name); }
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(); }
public ActionResult <TicketCategory> PutTicketCategory([FromBody] TicketCategory ticketCategory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _unitOfWork.TicketCategories.UpdateTicketCategory(ticketCategory); _unitOfWork.Complete(); var updateTicketCategory = new UpdateTicketCategoryCommand(ticketCategory); _unitOfWork.SourceEvent(updateTicketCategory); } catch (Exception e) { Console.WriteLine(e); } return(Ok(ticketCategory)); }