public async Task <IActionResult> Create([Bind("MachiningToolId,ToolType,ToolDiameter,RadialMetric,Units,ToolDescription,VendorDescription,InitToolCount,ToolCount,PurchaseOrderNum,PurchaseOrderDate,PurchaseOrderCost,InvoiceNumber,VendorId,ToolingImageFile,ToolingImageBytes")] MachiningTool machiningTool) { if (ModelState.IsValid) { machiningTool.MachiningToolId = Guid.NewGuid(); // default tool count to the initial tool count machiningTool.ToolCount = machiningTool.InitToolCount; if (machiningTool.ToolingImageFile != null) { machiningTool.ToolingImageBytes = await FileURL.GetFileBytes(machiningTool.ToolingImageFile); } SetUIDs(); await _repo.AddMachiningTool(machiningTool); return(RedirectToAction(nameof(Index))); } ViewData["VendorId"] = new SelectList(await _repo.GetAllVendors(), "VendorId", "VendorName", machiningTool.VendorId); return(View(machiningTool)); }