Exemplo n.º 1
0
        public IEnumerable <ProductModel> GetAllProductByCategory(int categoryid)
        {
            using (pos_androidEntities context = new pos_androidEntities())
            {
                //string path = "http://103.233.79.234/Data/EverGreen_Android/ProductPictures/";

                var result = (from p in context.productmasters
                              where p.CategoryId == categoryid
                              orderby p.ProductName
                              select new ProductModel()
                {
                    ProductId = p.ProductId,
                    ProductName = p.ProductName,
                    CategoryId = (int)p.CategoryId,
                    UnitPrice = (decimal)p.UnitPrice,
                    GST = (decimal)p.GST,
                    Discount = (decimal)p.Discount,
                    TaxType = p.TaxType,
                    UOM = p.UOM,
                    SweetsReset = p.SweetsReset,
                    ProductDetails = p.ProductDetails,
                    Lock = p.Lock,
                    //StoreId = j4.StoreId
                }).ToList();

                //    var data = result.Select(p => new ProductModel()
                //    {
                //        ProductId = p.ProductId,
                //        ProductName = p.ProductName,
                //        CategoryId = (int)p.CategoryId,
                //        UnitPrice = (decimal)p.UnitPrice,
                //        GST = (decimal)p.GST,
                //        Discount = (decimal)p.Discount,
                //        TaxType = p.TaxType,
                //        UOM = p.UOM,
                //        HSN = p.HSN,
                //        SweetsReset = p.SweetsReset,
                //        ProductDetails = p.ProductDetails,
                //        Lock = p.Lock,

                //        //ProductPicturesUrl = path + p.ProductId + "ProductPictures.jpg",
                //}).ToList();
                return(result);
            }
        }
        //public IEnumerable<CategoryModel> GetAllCategoryList()
        //{
        //    using (pos_androidEntities context = new pos_androidEntities())
        //    {
        //        // string path = "http://103.233.79.234/Data/EverGreen_Android/CategoryPictures/";

        //        var result = context.categorymasters.OrderBy(c => c.CategoryName);
        //        var data = result.Select(c => new CategoryModel()
        //        {
        //            CategoryId = c.CategoryId,
        //            CategoryName = c.CategoryName,
        //            //CategoryDescription = c.CategoryDescription,
        //            //StoreId = (int)c.StoreId,
        //            //CategoryPictures = path + c.CategoryId + "CategoryPictures.jpg",
        //        }).ToList();
        //        return data;
        //    }
        //}

        public IEnumerable <CategoryModel> GetAllCategoryByMenuId(int storeid)
        {
            using (pos_androidEntities context = new pos_androidEntities())
            {
                //string path = "http://103.233.79.234/Data/EverGreen_Android/CategoryPictures/";

                var result = context.categorymasters.Where(c => c.StoreId == storeid).OrderBy(c => c.CategoryName);
                var data   = result.Select(c => new CategoryModel()
                {
                    CategoryId          = c.CategoryId,
                    CategoryName        = c.CategoryName,
                    CategoryDescription = c.CategoryDescription,
                    StoreId             = (int)c.StoreId,
                    //CategoryPictures = path + c.CategoryId + "CategoryPictures.jpg",
                }).ToList();
                return(data);
            }
        }