示例#1
0
 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));
 }
示例#2
0
 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));
 }
示例#3
0
 public ActionResult DeleteCustomer(int id)
 {
     _customerServices = new CustomerServices();
     _customerServices.DeleteCustomer(id);
     return(RedirectToAction("ListCustomer"));
 }
示例#4
0
 public ActionResult EditCustomer(CustomerModel model)
 {
     _customerServices = new CustomerServices();
     _customerServices.UpdateCustomer(model);
     return(RedirectToAction("ListCustomer"));
 }