public IHttpActionResult GetProfileInfo(Guid?Id) { UserRepository db = new UserRepository(); UserInfoRepository db2 = new UserInfoRepository(); FriendsRepository FriendRep = new FriendsRepository(); User user; ProfileInfo profileinfo; if (Id.HasValue) { user = db.GetUser(Id.Value); profileinfo = db2.GetUserProfileInfo(Id.Value); } else { user = db.GetUserByEmail(User.Identity.Name); profileinfo = db2.GetUserProfileInfo(user.Id); } ProfileViewModel viewmodel = new ProfileViewModel() { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, Gender = user.Gender, BirthDate = user.BirthDate, Work = profileinfo.Werk, School = profileinfo.School, Hometown = profileinfo.Woonplaats, Relation = profileinfo.RelatieStatus, Hobby = profileinfo.Hobbies, MemberSince = user.CreatedDate, ProfilePictureUrl = user.ProfilePictureUrl, Motto = profileinfo.Motto, AboutMe = profileinfo.AboutMe, Friends = FriendRep.GetUserFriends(user.Id) }; return(Ok(viewmodel)); }