public IActionResult Index(ECOMMERCE_MVC.Models.Customer a) { int s = ECOMMERCE_MVC.Models.Customer.LoginDB(a, _connection); if (s == 0) { ModelState.AddModelError("Email", "The Email is incorrect"); return(View()); } else if (s == 2) { ModelState.AddModelError("Password", "The Password is incorrect"); return(View()); } else { TempData["id"] = s; Models.Customer customer = Models.Customer.getCustomerDetails(s, _connection); HttpContext.Session.SetString("CustomerSession", JsonConvert.SerializeObject(customer)); return(RedirectToAction("Profile", "Customer1")); } }
public IActionResult EditProfile(Models.Customer customerobject) { try { ECOMMERCE_MVC.Models.Customer customer = JsonConvert.DeserializeObject <Models.Customer>(HttpContext.Session.GetString("CustomerSession")); customerobject.Id = customer.Id; customer.Name = customerobject.Name; customer.Address = customerobject.Address; customer.Email = customerobject.Email; Models.Customer.UpdateProfile(customer, _connection); HttpContext.Session.SetString("CustomerSession", JsonConvert.SerializeObject(customer)); Debug.WriteLine("----------------------------------------------------------------------"); Debug.WriteLine(customerobject.Name); Debug.WriteLine(customerobject.Email); Debug.WriteLine(customerobject.Address); return(RedirectToAction("EditDetails", "Customer1")); } catch (Exception e) { return(RedirectToAction("Index", "Customer1")); } }
public IActionResult EditProfile() { try { ECOMMERCE_MVC.Models.Customer customer = JsonConvert.DeserializeObject <Models.Customer>(HttpContext.Session.GetString("CustomerSession")); ViewBag.IsLogged = "true"; ViewBag.Name = customer.Name; ViewBag.password = customer.Password; return(View(customer)); } catch (Exception e) { return(RedirectToAction("Index", "Customer1")); } }
public IActionResult EditPasswordAction(String?password) { ; try { ECOMMERCE_MVC.Models.Customer customer = JsonConvert.DeserializeObject <Models.Customer>(HttpContext.Session.GetString("CustomerSession")); Debug.WriteLine("Id===" + customer.Id + password); Models.Customer.UpdatePassword(password, customer.Id, _connection); customer.Password = password; HttpContext.Session.SetString("CustomerSession", JsonConvert.SerializeObject(customer)); return(RedirectToAction("Index", "Customer1")); } catch (Exception e) { return(RedirectToAction("Index", "Customer1")); } }