Пример #1
0
        public IHttpActionResult Put(int id, Echo data)
        {
            data.Id = id;
            var result = _echoService.Update(data);

            switch (result.ActionStatus.Status)
            {
            case ActionStatusEnum.Success:
                return(result.ActionStatus.SubStatus == ActionSubStatusEnum.Created
                               ? CreateHttpActionResult("Echo", result.ActionStatus.Id)
                               : StatusCode(HttpStatusCode.NoContent));

            case ActionStatusEnum.ValidationError:
                return(ApiControllerExtension.BadRequest(this, result.BrokenValidationRules, data.GetType().Name));
            }

            return(HandleErrorActionResult(result));
        }