public static List <FoodItemSmallModel> getMappedListOfAllFoodItemToFoodItemSmallModel() { RMSDBEntities db = DBContext.getInstance(); List <FoodItemSmallModel> list = new List <FoodItemSmallModel>(); foreach (tbl_FoodItem item in getAll()) { FoodItemSmallModel listItem = new FoodItemSmallModel(); listItem.Id = item.Id; listItem.Name = item.Name; listItem.Price = (int)item.SalePrice; list.Add(listItem); } return(list); }
public static List <FoodItemSmallModel> getMAppedListOfDealDetailsToFoodItemSmallModelByDealId(int dealId) { RMSDBEntities db = DBContext.getInstance(); List <tbl_DealFoodItem> list = db.tbl_DealFoodItem.Where(a => a.Deal_Id == dealId).ToList(); List <FoodItemSmallModel> mappedList = new List <FoodItemSmallModel>(); foreach (tbl_DealFoodItem item in list) { FoodItemSmallModel tmp = new FoodItemSmallModel(); tmp.Id = (int)item.FoodItem_Id; tmp.Name = db.tbl_FoodItem.Find(item.FoodItem_Id).Name; tmp.Price = (int)db.tbl_FoodItem.Find(item.FoodItem_Id).SalePrice; mappedList.Add(tmp); } return(mappedList); }