public ActionResult Get(int profileThumbnailID) { ProfileThumbnail pt = ProfileThumbnail.CreateManager().Load(profileThumbnailID); if (pt == null) { Log.Error("Profile thumbnail does not exist."); return(this.InternalError()); } ProfileThumbnailData ptd = ProfileThumbnailData.LoadByProfileThumbnail(pt).FirstOrDefault(); if (ptd == null) { Log.Error("COULD NOT LOAD THUMBNAIL. ProfileThumbnailData is null for ProfileThumbnailID=" + profileThumbnailID); return(this.InternalError()); } return(File(ptd.Data, "image/jpg", string.Format("{0}{1}", profileThumbnailID, ".jpg"))); }
public ProfileCache(Profile profile) : base(profile) { lock (CacheLockObject) { // SUMMARY: Adding ProfileThumbnail ProfileThumbnail profileThumbnail = ProfileThumbnail.CreateManager().Load(profile, ThumbnailIdentifier.Default).FirstOrDefault(); if (profileThumbnail != null) { ProfileThumbnailData thumbnailData = ProfileThumbnailData.LoadByProfileThumbnail(profileThumbnail, null).FirstOrDefault(); this._defaultThumbnail = thumbnailData.Data; this._thumbnailUrl = string.Format("/thumbnails/default/{0}", profile.ID); } this._id = profile.ID; this._url = string.Format("/profile/{0}", profile.ID); this._details = new Dictionary <string, ProfileDetail>(); List <ProfileDetail> profileDetails = ProfileDetail.CreateManager().Load(profile); if (profileDetails == null || profileDetails.Count == 0) { this._hasError = true; Log.Error("web.Profile:" + this._id + " does not have any ProfileDetail"); return; } foreach (ProfileDetail pd in profileDetails) { if (this._details.ContainsKey(pd.Language.TwoLetterIsoCode)) { continue; } this._details.Add(pd.Language.TwoLetterIsoCode, pd); } } }