public IHttpActionResult PostAdminLogin(Logincredentials cred) { adminMaster temp = db.adminMasters.Where(x => x.admin_username == cred.user_name && x.admin_password == cred.user_password).FirstOrDefault(); if (temp == null) { return(Ok(0)); } return(Ok(1)); }
public ActionResult login(adminMaster adminMaster) { try { adminMaster data = db.adminMasters.SingleOrDefault(a => a.emailid == adminMaster.emailid && a.password == adminMaster.password); if (data != null) { TempData["Message"] = "Welcome admin!"; Session["adminDetails"] = data.name; return(RedirectToAction("index", "adminHome")); } TempData["Error"] = "Wrong Login Details!"; } catch (Exception ex) { TempData["Error"] = ex.Message; } return(View()); }
public IHttpActionResult PostAdminLogin(Logincredentials cred) { LoginResponseModel1 loginres = new LoginResponseModel1(); adminMaster temp = db.adminMasters.Where(x => x.admin_username == cred.user_name && x.admin_password == cred.user_password).FirstOrDefault(); if (temp == null) { loginres.StatusCode = 0; loginres.Message = "Invalid Login"; loginres.Admin_username = null; return(Ok(loginres)); } else { loginres.StatusCode = 1; loginres.Message = "Login Successful"; loginres.Admin_username = temp.admin_username; return(Ok(loginres)); } }