public static PhotoDao ConvertPhotoToPhotoDao(Photo photo) { var photoDao = new PhotoDao(); photoDao.Id = photo.Id; photoDao.CreateDate = photo.Create; photoDao.UpdateDate = photo.Update; photoDao.LikedByUser = photo.LikedByUser; photoDao.Likes = photo.Likes; photoDao.Description = photo.Description; photoDao.UserId = photo.User?.Id; return(photoDao); }
public static Photo ConvertDataToPhoto(PhotoDao photo, UserDao user, UserImageUrlDao imgUrls, PhotoUrlDao urls) { var photoData = new Photo(); photoData.Id = photo.Id; photoData.Create = photo.CreateDate; photoData.Update = photo.UpdateDate; photoData.LikedByUser = photo.LikedByUser; photoData.Likes = photo.Likes; photoData.Description = photo.Description; if (user != null) { var userData = new User(); userData.Id = user.Id; userData.Name = user.Name; if (imgUrls != null) { var profileImgData = new ProfileImageModel(); profileImgData.Large = imgUrls.Large; profileImgData.Medium = imgUrls.Medium; profileImgData.Small = imgUrls.Small; userData.ProfileImages = profileImgData; } photoData.User = userData; } if (urls != null) { var photoUrlData = new Url(); photoUrlData.Raw = urls.Raw; photoUrlData.Regular = urls.Regular; photoUrlData.Small = urls.Small; photoUrlData.Thumb = urls.Thumb; photoData.Urls = photoUrlData; } return(photoData); }
// GET: Image/Image public ActionResult ImgList() { var model = new PhotoDao().ImgList(); return(View(model)); }