Esempio n. 1
0
        public async Task <IActionResult> ChangeAnswer([FromBody] ChangeAnswer answer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var response = await _answerService.ChangeAnswer(answer);

                if (response.Error != null)
                {
                    return(StatusCode(response.Error.ErrorCode, response.Error.ErrorDescriprion));
                }
                return(Ok(response.Data));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, new Error(ex.Message)));
            }
        }