public static LeftMenuViewModel Get(User user, string selectedMenu) { var result = new LeftMenuViewModel() { CompanyNameWithTypeOfOwnership = user.CompanyNameWithTypeOfOwnership, Rating = user.Rating.ToString(), RatingImagesHtml = user.RatingImagesHtml, SelectedMenu = selectedMenu, CurrentUserId = user.Id }; if (user.SmallPhotoUrl != null) { result.SmallPhotoUrl = user.SmallPhotoUrl; } else { //var photos = PhotosDAL.GetCompanyLogoGroup(user.Id).OrderBy(p => p.Width).ToList(); //result.SmallPhotoUrl = photos.Any() ? photos.First().Url : PhotoHelper.NoLogoImageUrl; user.LogoGroup = PhotosDAL.GetCompanyLogoGroup(user.Id); result.SmallPhotoUrl = user.GetBestFitLogoPhoto(1).Url; } result.AdsCount = AdsDAL.GetAdsCount((int)AdStatuses.Published, user.Id); result.UnreadMessagesCount = MessagesDAL.GetUnreadMessagesCount(user.Id); return(result); }