public ActionResult Description(int id) { DescriptionDTO description = _descriptionService.GetDescriptionByIdRealEstate(id); var photoForGalleryDto = _descriptionService.GetPhotoForGalleryById(id).ToList(); var model = new EditDescriptionViewModel() { RealEstateId = description.RealEstateId, ShortDescription = description.ShortDescription, LongDescription = description.LongDescription, PhotosDto = photoForGalleryDto }; ViewBag.Id = id; return(View(model)); }
public ActionResult Particulars(int id) { RealEstateDTO real = _realEstateService.GetRealEstateById(id); DescriptionDTO description = _descriptionService.GetDescriptionByIdRealEstate(real.Id); if (description == null) { _descriptionService.AddDescriptionDto(real.Id); _descriptionService.Save(); description = _descriptionService.GetDescriptionByIdRealEstate(real.Id); } var photos = new List <PhotoForGalleryDTO>(); int count = 0; foreach (var item in _descriptionService.GetPhotoForGalleryById(id).ToList()) { if (count < 4) { photos.Add(new PhotoForGalleryDTO() { RealEstateId = item.RealEstateId, UrlImage = item.UrlImage, }); count++; } else { break; } } var model = new DescriptionViewModel() { Id = description.Id, Price = real.Price, Tenure = real.Tenure, Location = real.Location, RealEstateId = description.RealEstateId, ShortDescription = description.ShortDescription, LongDescription = description.LongDescription, PhotoForGalleryDto = photos }; ViewBag.LongDescription = description.LongDescription; return(View(model)); }