예제 #1
0
        public void Insert(Toy toy, int count)
        {
            var stockItem = new StockItem()
            {
                Count = count, Price = toy.Price * count, BaseToy = toy
            };

            _context.StockItems.Add(stockItem);
            _context.SaveChanges();
        }
예제 #2
0
        public User CreateUser(string login, string password, string answer)
        {
            var hash = CreateHash(password);
            var user = new User()
            {
                Login = login,
                AnswerToSecretQuestion = answer,
                PasswordHash           = hash
            };

            _context.Users.Add(user);
            _context.SaveChanges();

            return(GetUser(login, password));
        }
예제 #3
0
 public void Save()
 {
     _context.SaveChanges();
 }