Exemplo n.º 1
0
 public ActionResult Edit(CustomerEditVM customer2BUpdated)
 {
     if (ModelState.IsValid)
     {
         try
         {
             if (_mapper.verifyPW(_customerBL.GetCustomerByEmail(customer2BUpdated.CustomerEmail).CustomerPasswordHash, customer2BUpdated.CustomerPasswordHash))
             {
                 _customerBL.UpdateCustomer(_mapper.cast2Customer(customer2BUpdated));
                 Log.Information($"Customer updated-- Email: {customer2BUpdated.CustomerEmail}");
                 return(RedirectToAction(nameof(Index)));
             }
             else
             {
                 Log.Information($"Customer not updated; incorrect password-- Email: {customer2BUpdated.CustomerEmail}");
                 return(RedirectToAction(nameof(Index)));
             }
         }
         catch (Exception e)
         {
             Helper.WriteError(e, "Error");
             Helper.WriteFatal(e, "Fatal");
             Helper.WriteVerbose(e, "Verbose");
             return(View());
         }
     }
     return(View());
 }