public static SealedBoxViewModel BuildFromStyleId(IUnitOfWork db, long styleId)
        {
            var model = new SealedBoxViewModel();

            var style = db.Styles.GetByStyleIdAsDto(styleId);

            model.StyleString = style.StyleID;

            model.StyleId = styleId;
            model.Owned   = true;

            model.Price = db.OpenBoxes.GetByStyleId(styleId).OrderBy(b => b.Id).Select(b => b.Price).FirstOrDefault();

            var styleItems = db.StyleItems.GetByStyleIdWithSizeGroupAsDto(styleId)
                             .OrderBy(si => SizeHelper.GetSizeIndex(si.Size))
                             .ThenBy(si => si.Color)
                             .ToList();

            model.StyleItems = new StyleItemCollection()
            {
                DisplayMode = StyleItemDisplayMode.BoxBreakdown,
                Items       = styleItems.Select(si => new StyleItemViewModel(si)).ToList()
            };
            SetDefaultBreakdowns(model.StyleItems.Items.ToList());

            model.CreateDate = DateHelper.GetAppNowTime().Date;

            model.BoxBarcode = db.SealedBoxes.GetDefaultBoxName(styleId, model.CreateDate.Value);

            return(model);
        }
        public static SealedBoxViewModel BuildFromBoxId(IUnitOfWork db, long sealedBoxId)
        {
            var model = new SealedBoxViewModel();

            var item         = db.SealedBoxes.GetAllAsDto().FirstOrDefault(b => b.Id == sealedBoxId);
            var style        = db.Styles.GetByStyleIdAsDto(item.StyleId);
            var styleItems   = db.StyleItems.GetByStyleIdWithSizeGroupAsDto(item.StyleId).ToList();
            var boxSizeItems = db.SealedBoxItems.GetByBoxIdAsDto(sealedBoxId).ToList();

            model.ConstructFrom(item, style, styleItems, boxSizeItems);

            return(model);
        }