public void Execute(RoleUseCaseDto request) { var roleUseCase = _mapper.Map <RoleUseCase>(request); _context.RoleUseCases.Add(roleUseCase); _context.SaveChanges(); }
public void Execute(RoleUseCaseDto request) { if (_context.RoleUseCases.Find(request.Id) == null) { throw new EntityNotFoundException(request.Id, typeof(RoleUseCase)); } var category = _context.RoleUseCases.Find(request.Id); _mapper.Map(request, category); _context.SaveChanges(); }
public IActionResult Put(int id, [FromBody] RoleUseCaseDto dto, [FromServices] IUpdateRoleUseCaseCommand command) { dto.Id = id; _executor.ExecuteCommand(command, dto); return(NoContent()); }
public IActionResult Post([FromBody] RoleUseCaseDto dto, [FromServices] ICreateRoleUserCaseCommand command) { _executor.ExecuteCommand(command, dto); return(StatusCode(StatusCodes.Status201Created)); }