Exemplo n.º 1
0
 public ActionResult TenantSignup(Tenant tenant)
 {
     using (BuildingManagementDBEntities context = new
                                                   BuildingManagementDBEntities())
     {
         context.Tenants.Add(tenant);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
Exemplo n.º 2
0
 public ActionResult employeeSignup(Employee emp)
 {
     using (BuildingManagementDBEntities context = new
                                                   BuildingManagementDBEntities())
     {
         context.Employees.Add(emp);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
Exemplo n.º 3
0
 public ActionResult TenantLogin(Tenant model)
 {
     using (BuildingManagementDBEntities context = new BuildingManagementDBEntities())
     {
         bool isValidUser = context.Tenants.Any(user => user.Email.ToLower() == model.Email.ToLower() && user.Password == model.Password);
         if (isValidUser)
         {
             FormsAuthentication.SetAuthCookie(model.Email, false);
             return(RedirectToAction("Index", "Tenants"));
         }
         ModelState.AddModelError("", "Invalid email or password !");
         return(View());
     }
 }