Esempio n. 1
0
        public async Task <IActionResult> Store([FromBody] SoftwareHouse house)
        {
            try
            {
                var validation = await _validator.ValidateAsync(house);

                if (!validation.IsValid)
                {
                    return(_response.ValidationError(ValidationHelper.BeautifyReturn(validation)));
                }

                _service.Add(house);

                return(_response.Success(statusCode: 201, data: _mapper.Map <SoftwareHouseReturnViewModel>(house)));
            }
            catch (Exception ex)
            {
                return(_response.Error(message: ex.Message, data: ex.InnerException?.Message));
            }
        }