public ActionResult Index() { var estates = new List<HomeIndexEstateViewModel>(); var appliances = new List<HomeIndexApplianceViewModel>(); if (this.HttpContext.Cache["Home estates"] != null && this.HttpContext.Cache["Home appliances"] != null) { ViewBag.Estates = this.HttpContext.Cache["Home estates"]; ViewBag.Appliances = this.HttpContext.Cache["Home appliances"]; } else { estates = this.estates .GetAll() .OrderByDescending(e => e.Ratings.Count() == 0 ? 0 : e.Ratings.Sum(r => r.Value) / e.Ratings.Count()) .Take(15) .To<HomeIndexEstateViewModel>() .ToList(); appliances = this.appliances .GetAll() .OrderByDescending(a => a.Ratings.Count() == 0 ? 0 : a.Ratings.Sum(r => r.Value) / a.Ratings.Count()) .Take(15) .To<HomeIndexApplianceViewModel>() .ToList(); ViewBag.Estates = estates; ViewBag.Appliances = appliances; this.HttpContext.Cache["Home estates"] = estates; this.HttpContext.Cache["Home appliances"] = appliances; } return this.View(ViewBag); }
public PropertyController(ApplicationDbContext context, IEstateService estateService, IMapper mapper) { this.context = context; this.estateService = estateService; this.mapper = mapper; }
public AdminController(ApplicationDbContext context, IContactService contactService, IEstateService estateService) { this.context = context; this.contactService = contactService; this.estateService = estateService; }
public EstateReviewsController(IReviewService reviewService, IEstateService estateService, IMapper mapper) { _reviewService = reviewService; _estateService = estateService; _mapper = mapper; }
public HomeController(IEstateService _estateService) { _EstateService = _estateService ?? throw new System.ArgumentNullException(nameof(_estateService)); }
public EstatesController(IEstateService estateService, IMapper mapper) { _estateService = estateService; _mapper = mapper; }
public EstatesController(ApplicationDbContext context, IEstateService estateService) { _context = context; _estateService = estateService; }
public EstatesController(KashanehContext context, IEstateService estateService, IUserService userService) { _context = context; _estateService = estateService; _userService = userService; }
public HomeController(IEstateService estateService) { _estateService = estateService; }
public HomeController(IEstateService estates, IApplianceService appliances) { this.estates = estates; this.appliances = appliances; }
public EstateApiController(IEstateService estateService, IUserService userService) { this._estateService = estateService; this._userService = userService; userId = Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(RequestContext.Principal.Identity); }
public EstateApiRestController(IEstateService estateService) { m_estateService = estateService; }