Ejemplo n.º 1
0
        //[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);
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 public async Task <HandleResultDto> Put([FromBody] UpdateArticleCategoryCommand cmd)
 {
     return(await _mediator.Send(cmd, HttpContext.RequestAborted));
 }