コード例 #1
0
        public async Task <ActionResult> PutRequest(int id, [FromBody] Other other)
        {
            try
            {
                VerifyUser();
                _validateService.Validate(other);
                Other otherToUpdate = await _otherService.GetSingleById(id);

                await _otherService.Update(otherToUpdate, other);

                return(NoContent());
            }
            catch (ServiceValidationExeption e)
            {
                var result = new ResultFormatter(API_VERSION, General.BAD_REQUEST_STATUS_CODE, General.BAD_REQUEST_MESSAGE)
                             .Fail(e);
                return(BadRequest(result));
            }
            catch (Exception e)
            {
                var result = new ResultFormatter(API_VERSION, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                             .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, result));
            }
        }