public ActionResult <ItemResponse <UserProfile> > GetByUserId()
        {
            ItemResponse <UserProfile> response = null;
            ActionResult result = null;
            int          id     = _authService.GetCurrentUserId();

            try
            {
                UserProfile profile = _userProfileServices.Get(id);

                if (profile == null)
                {
                    result = NotFound404(new ErrorResponse("Doesn't Exist"));
                }
                else
                {
                    response      = new ItemResponse <UserProfile>();
                    response.Item = profile;
                    result        = Ok200(response);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());

                result = StatusCode(500, new ErrorResponse(ex.Message));
            }

            return(result);
        }
Exemplo n.º 2
0
 public JsonResult Get(int id)
 {
     try
     {
         return(Json(_userProfileServices.Get(id: 2)));
     }
     catch (Exception ex)
     {
         throw;
     }
 }