public static User Entry() { string login = SetInformations.SetLogin(); string password = SetInformations.SetPassword(); using (var context = new CartContext()) { return(context.Users.Where(user => user.Login == login && user.Password == password).SingleOrDefault()); } }
public static void Registration() { User newUser = new User() { Login = SetInformations.SetLogin(), Password = SetInformations.SetPassword() }; Cart newCart = new Cart() { User = newUser }; using (var context = new CartContext()) { if (context.Users.All(user => user.Login != newUser.Login)) { context.Carts.Add(newCart); context.SaveChanges(); } } }