示例#1
0
        public static Slot ToSlotEntity(this KioskBindingModel model, int kioskId, SystemDataListEnums.TierType tierTypeId, string slotName, Slot original = null)
        {
            var isUpdate = original != null;
            var entity   = isUpdate
                ? model.Map(original)                     // update
                : model.Map <KioskBindingModel, Slot>();  //insert

            entity.SlotName    = slotName;
            entity.KioskId     = kioskId;
            entity.TierTypeId  = tierTypeId;
            entity.IsAvailable = true;

            if (tierTypeId != SystemDataListEnums.TierType.Tier2)
            {
                return(entity);
            }

            entity.JanPrice     = model.Tier2JanPrice;
            entity.FebPrice     = model.Tier2FebPrice;
            entity.MarPrice     = model.Tier2MarPrice;
            entity.AprPrice     = model.Tier2AprPrice;
            entity.MayPrice     = model.Tier2MayPrice;
            entity.JunePrice    = model.Tier2JunePrice;
            entity.JulyPrice    = model.Tier2JulyPrice;
            entity.AugPrice     = model.Tier2AugPrice;
            entity.SepPrice     = model.Tier2SepPrice;
            entity.OctPrice     = model.Tier2OctPrice;
            entity.NovPrice     = model.Tier2NovPrice;
            entity.DecPrice     = model.Tier2DecPrice;
            entity.NextJanPrice = model.Tier2NextJanPrice;
            entity.NextFebPrice = model.Tier2NextFebPrice;
            entity.NextMarPrice = model.Tier2NextMarPrice;

            return(entity);
        }
        IPagedList <Slot> ISlotRepository.Filter(int kioskId, SystemDataListEnums.TierType tierTypeId)
        {
            var slots = Context.Slots.Where(x => x.KioskId == kioskId && x.TierTypeId == tierTypeId)
                        .OrderByDescending(o => o.Id).ToPagedList(1, 1000);

            return(slots);
        }
 public DataActionResponse GetSlotsByKioskIdAndTierTypeId(int slotId, SystemDataListEnums.TierType tierTypeId)
 {
     return(_slotService.GetSlotsByKioskIdAndTierTypeId(slotId, tierTypeId)
            .CreateDataActionResponseSuccess());
 }
示例#4
0
        public TrueFormPagedList <SlotViewModel> GetSlotsByKioskIdAndTierTypeId(int kioskId, SystemDataListEnums.TierType tierTypeId)
        {
            var slots = _slotRepository.Filter(kioskId, tierTypeId);

            return(slots.ToViewModel());
        }