public ProductIPListModel FindProductIPListModel(int productId, int index = 0, int pageNo = 1, int pageSize = Int32.MaxValue) { var model = new ProductIPListModel(); // Get all the markets var allItems = db.FindLOVItems(null, LOVName.MarketingLocation); var ipList = db.FindProductIPs(productId); foreach (var item in allItems.Skip((pageNo - 1) * pageSize) .Take(pageSize)) { var newItem = new ProductIPModel(); var temp = ipList.Where(il => il.MarketId == item.Id).FirstOrDefault(); if (temp != null) { // Product has the market applied newItem.Id = temp.Id; newItem.Selected = true; } newItem.ProductId = productId; newItem.MarketId = item.Id; newItem.MarketNameText = item.ItemText; model.Items.Add(newItem); } return(model); }
private ProductIPModel createProductIP(int productId, int marketId) { ProductIPModel model = new ProductIPModel(); model.ProductId = productId; model.MarketId = marketId; return(model); }