public ExpenseIncome Create(ExpenseIncome expenseIncome)
        {
            if (expenseIncome.ExpenseOrIncome.ToString() != "Expense" && expenseIncome.ExpenseOrIncome.ToString() != "Income" && expenseIncome.ExpenseOrIncome.ToString() != "Transfer")
            {
                return(null);
            }

            expenseIncome.TransferToAccountId = 0;

            _context.Add(expenseIncome);
            _context.SaveChanges();
            return(expenseIncome);
        }
        public User Create(User user)
        {
            using (var sha256 = SHA256.Create())
            {
                var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(user.Password));
                var hash        = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower();
                user.Password = hash;
            }

            _context.Users.Add(user);
            _context.SaveChanges();
            return(user);
        }
Exemplo n.º 3
0
 public Category Create(Category category)
 {
     _context.Add(category);
     _context.SaveChanges();
     return(category);
 }
Exemplo n.º 4
0
 public Account Create(Account account)
 {
     _context.Add(account);
     _context.SaveChanges();
     return(account);
 }
Exemplo n.º 5
0
 public ShoppingCart Create(ShoppingCart shoppingCart)
 {
     _context.Add <ShoppingCart>(shoppingCart);
     _context.SaveChanges();
     return(shoppingCart);
 }
 public Item Create(Item item)
 {
     _context.Add <Item>(item);
     _context.SaveChanges();
     return(item);
 }