public string LoginUser(string userName, string password) { string[][] contentArray = new string[2][]; BBUserAccount ua = new BBUserAccount(); if (ua.validateUserPassword(userName, password)) { UserAccount user = ua.getUserAccountByUserName(userName); contentArray[0] = new string[] { "OK" }; contentArray[1] = new string[] { user.IdUser.ToString(), user.UserName, user.FirstName, user.LastName, user.IdCity.ToString(), user.IdCountry.ToString(), user.CountryName, user.CityName }; } else { contentArray[0] = new string[] { "NOT OK" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(contentArray); return json; }
public string LoginUser(string userName, string password) { string[][] contentArray = new string[2][]; BBUserAccount ua = new BBUserAccount(); if (ua.validateUserPassword(userName, password)) { UserAccount user = ua.getUserAccountByUserName(userName); contentArray[0] = new string[] { "OK" }; contentArray[1] = new string[] { user.IdUser.ToString(), user.UserName, user.FirstName, user.LastName, user.IdCity.ToString(), user.IdCountry.ToString(), user.CountryName, user.CityName }; } else { contentArray[0] = new string[] { "NOT OK" }; } JavaScriptSerializer js = new JavaScriptSerializer(); string json = js.Serialize(contentArray); return(json); }