public IHttpActionResult GetAllProfiles() { UserProfileService userProfileService = CreateUserProfileService(); List <UserProfileListItem> userProfiles = userProfileService.GetAllUserProfiles(); return(Ok(userProfiles)); }
// GET: UserProfiles public ActionResult Index() { var userProfiles = _userProfileService.GetAllUserProfiles(); foreach (var up in userProfiles) { var relativePath = "~/Content/avatars/" + up.Id + "_avatar.jpg"; var absolutePath = HttpContext.Server.MapPath(relativePath); if (System.IO.File.Exists(absolutePath)) { up.AvatarUrl = "../../Content/avatars/" + up.Id + "_avatar.jpg"; } else { up.AvatarUrl = "../../Content/avatars/default_avatar.jpeg"; } } return(View(userProfiles)); }