public IHttpActionResult GetUserById(int UserId)
        {
            var response   = new DataResponse <EntityUser>();
            var repository = new RepositoryUserProfile();

            if (UserId != null)
            {
                response = repository.GetCurrentUserbyId(UserId);
            }
            else
            {
                response.Model = new EntityUser();
            }
            return(Ok <DataResponse>(response));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetUserById()
        {
            var response = new DataResponse <EntityUser>();

            if (!User.Identity.IsAuthenticated)
            {
                return(Ok <dynamic>(new { IsSuccess = 0, Status = HttpStatusCode.BadRequest, Message = "Authorization failed!" }));
            }
            response = repository.GetCurrentUserbyId(CurrentUserId);
            if (response != null)
            {
                return(Ok <DataResponse>(response));
            }
            else
            {
                return(Ok <dynamic>(new { IsSuccess = 0, Status = HttpStatusCode.BadRequest, Message = "Bad request!" }));
            }
        }