public async Task addToVendorsList(AddVendorListViewModel model, int userId) { OrderfromVendor order = new OrderfromVendor(); order.BrandName = model.brand; order.CategoryId = model.categoryName; order.Color = model.color; order.Quantity = model.quantity; order.Status = 0; order.SubCategoryId = model.subCategoryName; order.UnitofMeasure = model.unitOfMeasure; order.VendorName = model.vendorName; order.WarehouseManager = userId; db.OrderfromVendor.Add(order); await db.SaveChangesAsync(); }
public async Task <IActionResult> AddToVendorList(AddVendorListViewModel itemModel) { if (HttpContext.Session.GetString("Id") == null) { HttpContext.Session.Clear(); return(RedirectToAction("Index", "Account")); } if (ModelState.IsValid) { VendorListSave vendorList = new VendorListSave(db); await vendorList.addToVendorsList(itemModel, Convert.ToInt32(HttpContext.Session.GetString("Id"))); return(RedirectToAction("VendorList")); } else { return(RedirectToAction("VendorList", itemModel)); } }