private IFoundViewModel GetPhotoFoundViewModel(IFound found) { var photoModel = (PhotoFound)found; AlbumModel album = _albumService.GetAlbum(photoModel.AlbumId); string albumName = album.Name; UserModel user = _userService.GetUser(photoModel.OwnerId); string userName = user.FirstName + " " + user.LastName; string thumbnailPath = pathUtil.BuildThumbnailPath(photoModel.OwnerId, photoModel.AlbumId, photoModel.Id, photoModel.Format, ImageSize.Medium); return(new PhotoFoundViewModel { ThumbnailPath = thumbnailPath, PhotoViewUrl = urlUtil.BuildPhotoViewUrl(photoModel.Id), AlbumName = albumName, AlbumViewUrl = urlUtil.BuildAlbumViewUrl(photoModel.AlbumId), UserName = userName, UserViewUrl = urlUtil.BuildUserViewUrl(photoModel.OwnerId), DateOfCreation = photoModel.DateOfCreation, Rating = photoModel.Rating }); }
public void PhotoCommentAddedNotify(PhotoCommentModel mComment) { // TODO by Mikhail: mComment.UserId and mUser.Id are the same always var mUser = _userService.GetUser(mComment.UserId); // TODO this is a redundant line var mPhoto = _photoService.GetPhoto(mUser.Id, mComment.PhotoId); if (mPhoto.OwnerId != mComment.UserId) { var mPhotoOwner = _userService.GetUser(mPhoto.OwnerId); mPhotoOwner.Email = mPhotoOwner.Email.ToLower(); // todo: remove and refactor, when id to cookies will be added var noty = String.Format("Пользователь <span class='highlight_from'>{0} {1}</span> " + "добавил комментарий к вашей фотографии." , mUser.FirstName, mUser.LastName); _hubNotify.Clients.Group(mPhotoOwner.Email).SendNotification(NotificationTitles.CommentAdded, noty, _urlUtil.BuildPhotoViewUrl(mPhoto.Id)); } }