コード例 #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();
 }