Exemplo n.º 1
0
        public DtoCapacity GetCapacityByEventureListId(int id)
        {
            var capacity = new DtoCapacity(0, 0);

            var capacitySum = _contextProvider.Context.EventureLists.Where(ol => ol.Id == id).Sum(s => (Int32?)s.Capacity);

            //var queryOwnerEventures = db.Eventures.Where(e => e.Id == id).Select(e => e.Id);
            //var queryOwnersLists = db.EventureLists.Where(el => queryOwnerEventures.Contains(el.EventureId)).Select(l => l.Id);
            var regcount = _contextProvider.Context.Registrations.Count(r => r.EventureListId == id && r.EventureOrder.Status == "Complete");

            capacity.Regs     = regcount;
            capacity.Capacity = capacitySum ?? 0;

            return(capacity);
        }
Exemplo n.º 2
0
        public DtoCapacity GetCapacityByEventureId(int id)
        {
            //var rList = new List<DtoCapacity>();
            var capacity = new DtoCapacity(0, 0);

            var capacitySum = _contextProvider.Context.EventureLists.Where(ol => ol.EventureId == id).Sum(s => (int?)s.Capacity) ?? 0;
            //.Sum(income =>  (decimal?)income.Amount) ?? 0;

            var queryOwnerEventures = _contextProvider.Context.Eventures.Where(e => e.Id == id).Select(e => e.Id);
            var queryOwnersLists    = _contextProvider.Context.EventureLists.Where(el => queryOwnerEventures.Contains(el.EventureId)).Select(l => l.Id);
            var regcount            = _contextProvider.Context.Registrations.Count(r => queryOwnersLists.Contains(r.EventureListId) && r.EventureOrder.Status == "Complete");

            //rList.Add(new DtoCapacity(regcount, capacitySum));
            //rList.Add(new DtoCapacity(232, 666));

            capacity.Regs     = regcount;
            capacity.Capacity = capacitySum;

            return(capacity);
        }
Exemplo n.º 3
0
        public DtoCapacity GetCapacityByOwnerId(int id)
        {
            var capacity = new DtoCapacity(0, 0);

            var queryOwnerEventures = _contextProvider.Context.Eventures.Where(e => e.OwnerId == id).Select(e => e.Id);
            var capacitySum         = _contextProvider.Context.EventureLists.Where(ol => queryOwnerEventures.Contains(ol.Id)).Sum(s => s.Capacity);

            var queryOwnersLists = _contextProvider.Context.EventureLists.Where(el => queryOwnerEventures.Contains(el.EventureId)).Select(l => l.Id);
            var regcount         = _contextProvider.Context.Registrations.Count(r => queryOwnersLists.Contains(r.EventureListId) && r.EventureOrder.Status == "Complete");

            //var regcount = (from r in _contextProvider.Context.Registrations
            //               join o in _contextProvider.Context.Orders
            //                                    on r.EventureOrderId equals o.Id
            //                                    where r.EventureListId == id
            //                                    && o.Status == "Complete").Count()
            //                                    //select r.ParticipantId;

            capacity.Regs     = regcount;
            capacity.Capacity = capacitySum;

            return(capacity);
        }