Exemple #1
0
 public async Task<ActionResult> CreateStatusAysnc([FromBody] CreateStatusCommand request)
 {
     try
     {
         request.SetUser(User.GetUserId());
         var response = await _mediator.Send(request);
         return Ok(response);
     }
     catch (Exception ex)
     {
         _logger.Error(ex, $"Operation failed into controller {Routes.Create_Status} with message: {ex.Message}");
         return BadRequest(ex.Message);
     }
 }
Exemple #2
0
        public async Task CreateStatusAsync(CreateStatusCommand command)
        {
            if (command.Id == Guid.Empty)
            {
                throw new AggregateValidationException("Status Id is invalid.");
            }

            var status = await repository.GetAsync(command.Id);

            if (status != null)
            {
                throw new AggregateIllegalLogicException("Cannot create status with this Id. Status exists.");
            }

            await repository.CreateAsync(new StatusEntity(command.Id, command.Name));
        }
Exemple #3
0
        public void Post(Option status)
        {
            var command = new CreateStatusCommand();

            command.CreateStatus(status);
        }
Exemple #4
0
        public async Task <Unit> Post([FromBody] CreateStatusCommand request)
        {
            request.UserModel = await this.GetUserDetails("Ruru");

            return(await Mediator.Send(request));
        }