// GET: Products/Create public IActionResult Create() { Allproduct all = new Allproduct(); var cat = _context.category.ToList(); foreach (var item in cat) { all.categories.Add(item); } var subcat = _context.subcategory.ToList(); foreach (var item in subcat) { all.subCategories.Add(item); } var color = _context.color.ToList(); foreach (var item in color) { all.colors.Add(item); } var brands = _context.brand.ToList(); foreach (var item in brands) { all.brands.Add(item); } return(View(all)); }
// GET: Products/Edit/5 public async Task <IActionResult> Edit(int?id) { ViewBag.data = HttpContext.Session.GetObject(SD.Sessionname); ViewBag.branch = HttpContext.Session.GetObject(SD.Statusbranch); ViewBag.roll = HttpContext.Session.GetString("roll"); string Branch = ViewBag.branch; DateTime todaydate = DateTime.UtcNow; DateTime dateStart = DateTime.UtcNow.AddDays(-15); var pendingcustomer = _context.salesinvoicesummery.Where(p => p.status == "Pending" && p.Billdate >= dateStart && p.Billdate <= todaydate).ToList(); ViewBag.CustomerPending = pendingcustomer.Count(); var pendingvendor = _context.purchaseinvoicesummeries.Where(p => p.status == "Pending" && p.Billdate >= dateStart && p.Billdate <= todaydate).ToList(); ViewBag.VendorPending = pendingvendor.Count(); if (id == null) { return(NotFound()); } var product = await _context.product.FindAsync(id); Allproduct all = new Allproduct(); var cat = _context.category.ToList(); foreach (var item in cat) { all.categories.Add(item); } var subcat = _context.subcategory.ToList(); foreach (var item in subcat) { all.subCategories.Add(item); } var color = _context.color.ToList(); foreach (var item in color) { all.colors.Add(item); } if (product == null) { return(NotFound()); } return(View(product)); }