Esempio n. 1
0
 public async Task <IActionResult> Purchase([Bind("Id,FullName,CompanyName,CompanyCountry,EmailAddress")] Customer customer)
 {
     //var errors = ModelState.Values.SelectMany(v => v.Errors);
     customer.Id = 0; // Error where customer Id gets set to the business ID, temporary fix
     if (ModelState.IsValid)
     {
         repo.AddCustomer(customer);
         TempData["CustomerID"] = customer.Id;
         TempData["Product"]    = TempData["Product"];
         TempData["Price"]      = TempData["Price"];
         TempData["NoxID"]      = TempData["NoxID"];
         TempData["Name"]       = TempData["Name"];
         TempData.Keep();
         return(RedirectToAction(nameof(OnceOff)));
     }
     return(View(customer));
 }