Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 4
0
 public EstateReviewsController(IReviewService reviewService, IEstateService estateService, IMapper mapper)
 {
     _reviewService = reviewService;
     _estateService = estateService;
     _mapper        = mapper;
 }
Ejemplo n.º 5
0
 public HomeController(IEstateService _estateService)
 {
     _EstateService = _estateService ?? throw new System.ArgumentNullException(nameof(_estateService));
 }
Ejemplo n.º 6
0
 public EstatesController(IEstateService estateService, IMapper mapper)
 {
     _estateService = estateService;
     _mapper        = mapper;
 }
 public EstatesController(ApplicationDbContext context, IEstateService estateService)
 {
     _context       = context;
     _estateService = estateService;
 }
Ejemplo n.º 8
0
 public EstatesController(KashanehContext context, IEstateService estateService, IUserService userService)
 {
     _context       = context;
     _estateService = estateService;
     _userService   = userService;
 }
Ejemplo n.º 9
0
 public HomeController(IEstateService estateService)
 {
     _estateService = estateService;
 }
Ejemplo n.º 10
0
 public HomeController(IEstateService estates, IApplianceService appliances)
 {
     this.estates = estates;
     this.appliances = appliances;
 }
Ejemplo n.º 11
0
 public EstateApiController(IEstateService estateService, IUserService userService)
 {
     this._estateService = estateService;
     this._userService   = userService;
     userId = Microsoft.AspNet.Identity.IdentityExtensions.GetUserId(RequestContext.Principal.Identity);
 }
Ejemplo n.º 12
0
 public EstateApiRestController(IEstateService estateService)
 {
     m_estateService = estateService;
 }