コード例 #1
0
        public StyleQuantityViewModel(IUnitOfWork db, long styleId, DateTime when)
        {
            var style      = db.Styles.Get(styleId);
            var itemTypeId = style.ItemTypeId ?? StyleViewModel.DefaultItemType;

            StyleId     = styleId;
            StyleString = style.StyleID;

            Type = style.Type;

            Image    = style.Image;
            ItemType = itemTypeId;

            //Sizes
            var styleSizes = db.StyleItems.GetByStyleIdWithSizeGroupAsDto(styleId)
                             .ToList();
            var styleItemCache = db.StyleItemCaches.GetForStyleId(styleId).ToList();

            Sizes = BuildSizes(styleSizes,
                               styleItemCache);

            Listings = db.Listings.GetListingsAsListingDto()
                       .Where(l =>
                              l.StyleId == styleId &&
                              !l.IsFBA)
                       .ToList()
                       .Select(l => new ListingQuantityViewModel(l))
                       .OrderBy(l => l.SizeIndex)
                       .ThenBy(l => l.Market)
                       .ThenBy(l => l.SKU)
                       .ToList();

            Locations = StyleViewModel.GetLocations(db, style.Id);
        }
コード例 #2
0
        public StyleLocationViewModel(IUnitOfWork db, long styleId, DateTime when)
        {
            var style = db.Styles.Get(styleId);

            StyleId     = styleId;
            StyleString = style.StyleID;


            Image = style.Image;

            Locations = StyleViewModel.GetLocations(db, style.Id);
        }