public async Task <ActionResult> Update([FromBody] ObjectiveModel model)
        {
            if (!ModelState.IsValid)
            {
                throw new ValidationException("Form validation error");
            }
            var result = await _objectiveService.Update(model);

            if (result == Guid.Empty)
            {
                throw new ObjectiveNotFoundException("Objective not found for update.");
            }
            return(Ok(result));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] ObjectiveModel model)
        {
            try
            {
                var response = await _service.Update(model);

                if (!response.IsSuccessful)
                {
                    return(BadRequest(response));
                }
                return(Ok(response));
            }
            catch
            {
                return(StatusCode(500, "Internal Server Error."));
            }
        }