public IActionResult Edit(long id, HardwareViewModel hardwareViewModel, string productChild, bool?goToProductSupplier, bool?goToProductDetail, [Bind("ProductID,ProductTypeID,Name,Description,StatusID,InfoUrl,SpecificationFile")] Hardware hardware) { if (id != hardware.ProductID) { return(NotFound()); } //if (hardwareViewModel.File != null) //{ //upload file Tuple <string, string, bool> filePath = service.UploadProductPdf(hardwareViewModel.hardware.ProductID, hardwareViewModel.FileDescription, hardwareViewModel.File); //add FileName and FilePath to hardware so that this will be saved to the database hardware.SpecificationFileName = filePath.Item1; hardware.SpecificationFilePath = filePath.Item2; hardware.HasFile = filePath.Item3; //} ModelState.Clear(); TryValidateModel(hardware); if (ModelState.IsValid) { try { service.Update(hardware); } catch (DbUpdateConcurrencyException) { if (!HardwareExists(hardware.ProductID)) { return(NotFound()); } else { throw; } } if (goToProductSupplier == true) { return(RedirectToAction("Create", "ProductSupplier", new { productID = hardware.ProductID, productChild })); } else if (goToProductDetail == true) { return(RedirectToAction("Create", "ProductDetail", new { productID = hardware.ProductID, productChild })); } else { return(RedirectToAction(nameof(Index))); } } ProductTypeDropDown(hardware.ProductTypeID); StatusDropDown(hardware.StatusID); //ViewData["ProductTypeID"] = new List<SelectListItem>(service.GetSelectListProductTypeHardware()); return(View(hardware)); }