Esempio n. 1
0
        public async Task <IActionResult> Put([FromBody] WorstCaseBudgetCashflowFormDto form)
        {
            try
            {
                VerifyUser();
                _validateService.Validate(form);

                var result = await _service.UpsertWorstCaseBudgetCashflowUnit(form);

                var response = new ResultFormatter(ApiVersion, General.CREATED_STATUS_CODE, General.OK_MESSAGE).Ok();
                return(NoContent());
            }
            catch (ServiceValidationExeption e)
            {
                var response = new ResultFormatter(ApiVersion, General.BAD_REQUEST_STATUS_CODE, General.BAD_REQUEST_MESSAGE).Fail(e);
                return(BadRequest(response));
            }
            catch (Exception e)
            {
                var response = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message).Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, response));
            }
        }