Ejemplo n.º 1
0
        public ActionResult <StylesPopularClearanceDTO> GetStylesPolularClearance()
        {
            var result = new StylesPopularClearanceDTO()
            {
                Polulars   = _styleRepo.GetPopulars(),
                Clearances = _styleRepo.GetClearances()
            };

            return(Ok(result));
        }
Ejemplo n.º 2
0
        public StylesPopularClearanceDTO GetStylesHomePage()
        {
            var polularIds = new List <int> {
                9, 17, 24
            };
            var clearanceIds = new List <int> {
                3, 8, 22
            };

            var styles = _DbContext.VwStyles.Where(vwStyle => clearanceIds.Contains(vwStyle.StyleId) ||
                                                   polularIds.Contains(vwStyle.StyleId))
                         .ProjectTo <StyleForListDTO>(_mapperProvider);

            var result = new StylesPopularClearanceDTO
            {
                Polulars   = styles.Where(style => style.PriceCurrent == style.PriceRegular),
                Clearances = styles.Where(style => style.PriceCurrent < style.PriceRegular)
            };

            return(result);
        }