Exemplo n.º 1
0
        public async Task <object> GetAllUserProfile()
        {
            try
            {
                var result = dataContext.UserProfile.Include(p => p.RegDocument).AsQueryable().Select(x => new UserProfile
                {
                    PysicalAddress = x.PysicalAddress,
                    Company        = x.Company,
                    Country        = x.Country,
                    Facebook       = x.Facebook,
                    Instagram      = x.Instagram,
                    Picture        = x.Picture,
                    RegDocument    = x.RegDocument,
                    State          = x.State,
                    Twitter        = x.Twitter,
                    Website        = x.Website,
                    UserID         = x.UserID
                });

                var ProfileList = new UserProfileListDTO
                {
                    UserProfiles = result.ToList()
                };
                res.Data    = ProfileList;
                res.Message = "List of Profile";
                res.Success = true;
                return(res);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public async Task <object> GetUserProfileByUserId(Guid UserId)
        {
            try
            {
                var result = dataContext.UserProfile.Where(x => x.UserID == UserId.ToString()).Include(p => p.RegDocument).AsQueryable().Select(x => new UserProfile
                {
                    PysicalAddress = x.PysicalAddress,
                    Company        = x.Company,
                    Country        = x.Country,
                    Facebook       = x.Facebook,
                    Instagram      = x.Instagram,
                    Picture        = x.Picture,
                    State          = x.State,
                    Twitter        = x.Twitter,
                    Website        = x.Website,
                    RegDocument    = x.RegDocument,
                    UserID         = x.UserID
                });

                var userProfileList = new UserProfileListDTO
                {
                    UserProfiles = result.ToList()
                };
                res.Data    = userProfileList;
                res.Message = "Profile for this user found";
                res.Success = true;
                return(res);
            }
            catch (Exception ex)
            {
                throw;
            }
        }