Exemplo n.º 1
0
        public async Task <IHttpActionResult> PresentNewAmendment(AmendmentCreate model)
        {
            _service.SetUserId(User.Identity.GetUserId());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (model == null)
            {
                return(BadRequest("Request body cannot be empty."));
            }

            if (await _service.CreateAmendmentAsync(model))
            {
                return(Ok("Amendment presented successfully."));
            }

            return(BadRequest("Cannot create amendment."));
        }