// GET: ListingController/Details/5
        public ActionResult Details(int id)
        {
            var listingModel = _listingService.GetById(id);

            var model = new ListingDetailModel
            {
                Id               = listingModel.Id,
                Address          = listingModel.Address,
                Category         = listingModel.Category.Name,
                DateCreated      = _listingService.ConvertToTimeAgo(listingModel.DateCreated),
                Description      = listingModel.Description,
                Images           = _listingService.GetApartmentImages(id),
                LaundryAvailable = listingModel.LaundryAvailable,
                NoOfBaths        = listingModel.NoOfBaths,
                NoOfBedrooms     = listingModel.NoOfBedrooms,
                OffStreetParking = listingModel.OffStreetParking,
                PostCode         = listingModel.PostCode,
                PricePerMonth    = listingModel.PricePerMonth
            };

            return(View(model));
        }
Exemple #2
0
        public IActionResult Detail(int id)
        {
            var club      = _listingService.GetById(id);
            var countries = _listingService.GetCountries().Select(x => new { Id = x.Id, Name = x.Name });;

            var logoUrl = "http://img.uefa.com/imgml/TP/teams/logos/70x70/";
            var clubUrl = "https://www.uefa.com/teamsandplayers/teams/club=";

            var model = new DetailModel()
            {
                Id             = club.Id,
                Name           = club.Name,
                Country        = club.Country,
                Eliminated     = club.Eliminated,
                ClubUrl        = clubUrl + club.Id + "/profile/index.html",
                LogoUrl        = logoUrl + club.Id + ".png",
                Countries      = new SelectList(countries, "Id", "Name"),
                FormCountryId  = club.Country.Id,
                FormEliminated = club.Eliminated
            };

            return(View(model));
        }