public User signup(Stream data) { OperationResult result = new OperationResult(); User currentUser = null; try { string s_params = getPostData(data); NameValueCollection postParams = HttpUtility.ParseQueryString(s_params); string userid = postParams["uname"]; string password = postParams["passwd"]; BikingDAL dal = new BikingDAL(); int returnVal = dal.InsertUser(userid, password); if (1==returnVal) { currentUser = new User(); currentUser.user = userid; currentUser.pass = password; } else if (2 == returnVal) { currentUser = new User(); currentUser.user = userid; currentUser.pass = password; currentUser.ERROR = "Duplicate"; } } catch (Exception ex) { //result.status = false; //result.Message = ex.Message; } return currentUser; }
public User login(Stream data) { OperationResult result = new OperationResult(); User currentUser = null; try { string s_params = getPostData(data); NameValueCollection postParams = HttpUtility.ParseQueryString(s_params); string userid = postParams["username"]; string password = postParams["password"]; BikingDAL dal = new BikingDAL(); result = dal.Login(userid, password); if (result.status) { currentUser = new User(); currentUser.user = userid; currentUser.pass = password; return currentUser; } } catch (Exception ex) { //result.status = false; //result.Message = ex.Message; } return currentUser; }