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