public IActionResult Calculate([FromBody] FibRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(HandleError());
            }

            try
            {
                _rabbitMqService.Send(model);
                return(Ok());
            }
            catch (Exception e)
            {
                return(HandleError(new[] { e.Message }));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PostUserAsync([FromBody] ProcessUser resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var user   = mapper.Map <ProcessUser, User>(resource);
            var result = await this.userService.CreateAsync(user);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            rabbitMqService.Send(result);

            return(Ok(result.User));
        }