public ActionResult AddCustomer(CustomerModel model) { _customerServices = new CustomerServices(); if (_customerServices.LoginExists(model.Login) != 0) { ModelState.AddModelError("Login", "This login already exists"); } else if (_customerServices.EmailExists(model.Email) != 0) { ModelState.AddModelError("Email", "This email already in use"); } else { _customerServices.InsertCustomer(model); return(RedirectToAction("AddCustomer")); } return(View(model)); }
public ActionResult Authorization(CustomerModel model) { _customerServices = new CustomerServices(); if (_customerServices.Authorization(model) != 0) { if (_customerServices.GetRoleByLogin(model.Login) == "user") { TempData["idUser"] = _customerServices.GetIdByLogin(model.Login); return(RedirectToAction("ListTheaterForUser", "Theater")); } else { return(RedirectToAction("Index", "AdminPage")); } } else { ModelState.AddModelError("Password", "Login or password entered incorrectly"); } return(View(model)); }
public ActionResult DeleteCustomer(int id) { _customerServices = new CustomerServices(); _customerServices.DeleteCustomer(id); return(RedirectToAction("ListCustomer")); }
public ActionResult EditCustomer(CustomerModel model) { _customerServices = new CustomerServices(); _customerServices.UpdateCustomer(model); return(RedirectToAction("ListCustomer")); }