public int RegisterUser(string email, string password, string DOB, string firstname, string lastname, string phone, string streetAddress, string zip, string country, string city) { using (var context = new ModelDataContext()) { var userRegitration = context.GetTable<UserInfo>(); var newUser = new UserInfo() { email = email, password = password, DOB = DateTime.Parse(DOB), FirstName = firstname, LastName = lastname, City =city, Country = country, Id = Guid.NewGuid(), Phone = phone, StreetAddress = streetAddress, Zip =zip }; userRegitration.InsertOnSubmit(newUser); context.SubmitChanges(); return 1; } return -1; }
public int UserExists(string email, string password) { using(var context = new ModelDataContext()) { var authentication = context.GetTable<UserInfo>(); var result = from row in authentication where row.email.Equals(email) && row.password.Equals(password) select row; return result.Count(); } }