public List <GetBillingSubItemModel> GetAllItems(string Id) { var ID = Convert.ToInt32(Id); int oulte = getOutletId(); var result = _entities.tblMenuOutlets.Where(o => o.OutletId == oulte && o.CategoryId == ID && o.tblItem.Active == true).ToList(); List <GetBillingSubItemModel> lst = new List <GetBillingSubItemModel>(); // query for when item is false in tbitems var dd = (from p in _entities.tblItems join q in _entities.tblMenuOutlets on p.ItemId equals q.ItemId where p.Active == true && q.OutletId == oulte && q.CategoryId == ID select new { ItemId = q.ItemId, Name = q.tblItem.Name, Color = p.tblCategory.Color, TextColor = p.tblCategory.TextColor }).ToList(); foreach (var item in result) { GetBillingSubItemModel model = new GetBillingSubItemModel(); model.Color = item.tblItem.tblCategory.Color; model.ItemId = item.ItemId; model.Name = item.tblItem.Name; model.TextColor = item.tblItem.tblCategory.TextColor; model.Outstock = outstock.CheckOutStockItem(item.ItemId); lst.Add(model); } return(lst); }
public List <GetBillingSubItemModel> getAllItemForBilling(int Id, int VendorId) { List <GetBillingSubItemModel> lst = new List <GetBillingSubItemModel>(); int OutletId = getOutletId(); var result = entities.tblMenuOutlets.Where(o => o.OutletId == OutletId && o.CategoryId == Id && o.tblItem.Active == true).ToList(); foreach (var item in result) { bool status = item.VendorPrices.Where(a => a.MenuOutletId == item.MenuOutletId && a.VendorId == VendorId).Any(); if (status) { GetBillingSubItemModel model = new GetBillingSubItemModel(); model.Color = item.tblCategory.Color; model.ItemId = item.ItemId; model.Name = item.tblItem.Name; model.TextColor = item.tblCategory.TextColor; model.Outstock = stock.CheckOutStockItem(item.ItemId); model.VendorId = VendorId; lst.Add(model); } } return(lst); }