public void Execute(UserUseCaseDto request)
        {
            var userUserCase = _mapper.Map <UserUseCase>(request);

            _context.UserUseCases.Add(userUserCase);
            _context.SaveChanges();
        }
        public void Execute(UserUseCaseDto request)
        {
            validator.ValidateAndThrow(request);

            var useCase = mapper.Map <UserUseCases>(request);

            context.Add(useCase);
            context.SaveChanges();
        }
Exemple #3
0
        public void Execute(UserUseCaseDto request)
        {
            _validator.ValidateAndThrow(request);

            var userusecase = new Domain.UserUseCase
            {
                UseCaseId = request.UseCaseId,
                UserId    = request.UserId
            };

            _context.UserUseCases.Add(userusecase);
            _context.SaveChanges();
        }
Exemple #4
0
        public void Execute(UserUseCaseDto request)
        {
            validator.ValidateAndThrow(request);

            var id = context.UserUseCases.Find(request.Id);

            if (id == null)
            {
                throw new EntityNotFoundException(request.Id, typeof(UserUseCases));
            }
            var usecase = context.UserUseCases.Where(x => x.Id == request.Id).First();

            mapper.Map(request, usecase);
        }
Exemple #5
0
 public void Post([FromBody] UserUseCaseDto dto, [FromServices] ICreateUserUseCaseCommand command)
 {
     executor.ExecuteCommand(command, dto);
 }
 public IActionResult Post([FromBody] UserUseCaseDto dto, [FromServices] IAddUserUseCaseCommand command)
 {
     _executor.ExecuteCommand(command, dto);
     return(StatusCode(StatusCodes.Status201Created));
 }
 public void Execute(UserUseCaseDto request)
 {
 }
 public IActionResult Put(int id, [FromBody] UserUseCaseDto dto, [FromServices] IUpdateUserUseCaseCommand command)
 {
     dto.Id = id;
     executor.ExecuteCommand(command, dto);
     return(StatusCode(StatusCodes.Status204NoContent));
 }