public void Execute(EditFestivalDto request) { var festival = _context.Festivals.Find(request.Id); if (festival == null) { throw new EntityNotFoundException(request.Id, typeof(Festival)); } _validator.ValidateAndThrow(request); _mapper.Map(request, festival); _context.SaveChanges(); }
public IActionResult Put(int id, [FromBody] EditFestivalDto dto, [FromServices] IEditFestivalCommand command) { dto.Id = id; _executor.ExecuteCommand(command, dto); return(NoContent()); }