public SysAdminInfo AdminLogin(SysAdmin admin) { var adminInfo = new SysAdminInfo(); string sql = $"select * from dbo.AspNetUsers where [UserName]={admin.AdminName} and [Email]={admin.LoginPwd}"; try { SqlDataReader objReader = SqlHelper.GetReader(sql); if (objReader.Read()) { adminInfo.Id = Convert.ToInt64(objReader["UserName"].ToString()); adminInfo.UserName = objReader["UserName"].ToString(); adminInfo.Email = objReader["Email"].ToString(); objReader.Close(); } else { admin = null; } } catch (Exception ex) { LogStoreHelper.WriteError(ex, $"SqlHelper.GetSingleResult error"); throw ex; } return(adminInfo); }
public SysAdminInfo AdminLogin(SysAdmin admin) { var adminInfo = new SysAdminInfo(); var service = new SysAdminService(); adminInfo = service.AdminLogin(admin); if (admin != null) { HttpContext.Current.Session["CurrentAdmin"] = admin; return(adminInfo); } return(null); }