コード例 #1
0
        public void Execute(CategoryPutDto request)
        {
            _validator.ValidateAndThrow(request);
            var category = _context.Categories.Find(request.Id);

            if (category == null)
            {
                throw new EntityNotFoundException(request.Id, typeof(Category));
            }

            category.Name = request.Name;

            _context.SaveChanges();
        }
コード例 #2
0
 public void Put([FromBody] CategoryPutDto dto, [FromServices] IUpdateCategoryCommand command)
 {
     executor.ExecuteCommand(command, dto);
 }