public ActionResult TenantSignup(Tenant tenant) { using (BuildingManagementDBEntities context = new BuildingManagementDBEntities()) { context.Tenants.Add(tenant); context.SaveChanges(); } return(RedirectToAction("Login")); }
public ActionResult employeeSignup(Employee emp) { using (BuildingManagementDBEntities context = new BuildingManagementDBEntities()) { context.Employees.Add(emp); context.SaveChanges(); } return(RedirectToAction("Login")); }
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()); } }