public bool Register(string username, string password, string email, string number) { bool result = false; using (SGEntities context = new SGEntities()) { try { User_statistics user_statistics = new User_statistics(); context.User_statistics.Add(user_statistics); User_info user_info = new User_info(email, number); context.User_info.Add(user_info); User user = new User(username, password); user.user_info = user_info.id; user.user_statistics = user_statistics.id; context.Users.Add(user); context.SaveChanges(); result = true; } catch (Exception) { } } return(result); }
public Price[] GetPrices(string name) { using (SGEntities context = new SGEntities()) { var prices = (from i in context.Items where i.label == name select i.Prices).Single(); return(prices.ToArray()); } }
public bool Login(string username, string password) { using (SGEntities context = new SGEntities()) { return((from u in context.Users where u.username == username && u.password == password select u).Any <User>()); } }
public Price GetPrice(string name, string shop) { using (SGEntities context = new SGEntities()) { try { var prices = (from i in context.Items where i.label == name select i.Prices).Single(); return((from p in prices where p.shop == shop select p).Single()); } catch (Exception) { return(null); } } }