Exemplo n.º 1
0
        // public IEnumerable<product> getProdById(int id)
        // {
        //
        //    return uf.getRepository<product>().GetAll().Where(e => e.CategoryId == id);
        // }
        public List <GroupModel> getQuantiteProdByCat()
        {
            /*  var productListResult = uf.getRepository<product>().GetAll()
             * .GroupBy(pv => pv.ProductPk)
             * .Select(g => new
             * {
             * Product = g.Key,
             * TotalOrderCount = g.Count(),
             * TotalSales = g.Sum(pv => pv.Price),
             * TotalQuantity = g.Sum(pv => pv.Quantity),
             * })
             * .OrderByDescending(x => x.TotalOrderCount).ToList();*/


            /* foreach (var line in uf.getRepository<product>().GetAll().GroupBy(info => info.CategoryId)
             *            .Select(group => new {
             *                Metric = group.Key,
             *                Count = group.Count()
             *            })
             *            .OrderBy(x => x.Metric)
             * {
             *   Console.WriteLine("{0} {1}", line.Metric, line.Count);
             * }*/

            var query = from p in uf.getRepository <product>().GetAll()
                        join c in uf.getRepository <category>().GetAll() on p.CategoryId equals c.CategoryId into e
                        from j in e.DefaultIfEmpty()
                        group p by p.CategoryId into g
                        select new GroupModel
            {
                id           = i++,
                Color        = String.Format("#{0:X6}", rnd.Next(0x1000000)),
                Highlight    = String.Format("#{0:X6}", rnd.Next(0x1000000)),
                Quantite     = g.ToList().Count(),
                CateogryName = uf.getRepository <category>().GetAll().Where(e => e.CategoryId == g.First().CategoryId).Single()
            };

            return(query.ToList());
        }
Exemplo n.º 2
0
 public IEnumerable <product> getProdById(int id)
 {
     return(utwk.getRepository <product>().GetAll().Where(e => e.category_fk == id));
 }
Exemplo n.º 3
0
 public virtual conger GetById(long id)
 {
     //  return _repository.GetById(id);
     return(uof.getRepository <conger>().GetById(id));
 }
Exemplo n.º 4
0
 public List <ExpositionArtwork> ExpositionArtworksByIdExposition(int idE)
 {
     return(utw.getRepository <ExpositionArtwork>().GetMany().Where(a => a.exposureId == idE).ToList());
 }
Exemplo n.º 5
0
 public IEnumerable <ReservationEvent> getReservationsEventByUser(string idSimpleUSer)
 {
     return(ut.getRepository <ReservationEvent>().GetMany(x => x.IdSimpleUser == idSimpleUSer));
 }