Beispiel #1
0
        public IActionResult Create(softwareViewModel softwareViewModel, [Bind("ProductID,StatusID,SoftwareTypeID,SoftwareVersion,ProductTypeID,ProductSupplierID,Name,Description,InfoUrl,Image,SpecificationFile")] Software software)
        {
            //upload file
            Tuple <string, string, bool> filePath = service.UploadProductPdf(softwareViewModel.software.ProductID, softwareViewModel.FileDescription, softwareViewModel.File);

            //add FileName and FilePath to hardware so that this will be saved to the database
            software.SpecificationFileName = filePath.Item1;
            software.SpecificationFilePath = filePath.Item2;
            software.HasFile = filePath.Item3;

            if (ModelState.IsValid)
            {
                software = service.Add(software);

                //Return to Edit view so that customer can see the software just added + can add supplier(s) info.
                return(RedirectToAction("Edit", new { id = software.ProductID }));
            }

            return(View(softwareViewModel));
        }