//[Authorize(Policy = "AdminAccount")] public IActionResult Update(Guid id, [FromBody] UpdateArticleCategoryCommand command) { command.CategoryId = id; _categoryAppService.Update(command); return(CreateResponse()); }
public void ShouldUpdateArticleCategory() { PopulateRepository(); UpdateArticleCategoryCommand command = new UpdateArticleCategoryCommand { CategoryId = new Guid("9008f2ce-3700-42ca-a514-48d0fa37c2f6"), Name = "RabbitMQ e AMPQ" }; applicationService.Update(command); Assert.AreEqual("RabbitMQ e AMPQ", applicationService.GetById(new Guid("9008f2ce-3700-42ca-a514-48d0fa37c2f6")).Name); }
public void Update(UpdateArticleCategoryCommand command) { command.Validate(); if (AddNotifications(command)) { return; } ArticleCategory category = _repository.GetById(command.CategoryId); if (NotifyNullCategory(category)) { return; } category = new ArticleCategory(command.CategoryId, command.Name); _repository.Update(category); Commit(); }
public async Task <HandleResultDto> Put([FromBody] UpdateArticleCategoryCommand cmd) { return(await _mediator.Send(cmd, HttpContext.RequestAborted)); }