//if the credential exist create session and return true //else return false public bool IsAdminExist(AdminModel adminModel) { Admin admin = new Admin { UserName = adminModel.UserName, Password = adminModel.Password }; if (homeRepository.AdminFound(admin).Any()) { HttpContext.Current.Session["Role"] = "Admin"; return(true); } return(false); }