Ejemplo n.º 1
0
        public async Task <IActionResult> ChangePublicState()
        {
            try
            {
                await mUsersService.ChangeUserIsPublicState(ClaimsExtractor.GetUserIdClaim(User.Claims));

                return(Ok(new ResponseApiModel <bool>
                {
                    IsSuccessfull = true,
                    ErrorMessage = null,
                    Response = true
                }));
            }
            catch (InvalidDataException ex)
            {
                return(BadRequest(new ResponseApiModel <bool>
                {
                    IsSuccessfull = false,
                    ErrorMessage = ex.Message
                }));
            }
            catch (KeyNotFoundException ex)
            {
                return(NotFound(new ResponseApiModel <bool>
                {
                    IsSuccessfull = false,
                    ErrorMessage = ex.Message
                }));
            }
            catch (Exception)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, new ResponseApiModel <bool>
                {
                    IsSuccessfull = false
                }));
            }
        }