Exemple #1
0
 public AuctionBidService(IOptions <AppSettings> appSettings, DesafioFullStackTotvsDataContext context)
 {
     _context = context;
     if (_context.AuctionBids.Count() == 0)
     {
         _context.AuctionBids.Add(new AuctionBid {
             BidPrice = 12
         });
         _context.SaveChanges();
     }
     _appSettings = appSettings.Value;
     _auctionBids.AddRange(_context.AuctionBids.ToList());
 }
Exemple #2
0
 public UserService(IOptions <AppSettings> appSettings, DesafioFullStackTotvsDataContext context)
 {
     _context = context;
     if (_context.Users.Count() == 0)
     {
         _context.Users.Add(new User {
             Name = "Item1"
         });
         _context.SaveChanges();
     }
     _appSettings = appSettings.Value;
     _users.AddRange(_context.Users.ToList());
 }
Exemple #3
0
 public AuctionService(IOptions <AppSettings> appSettings, DesafioFullStackTotvsDataContext context)
 {
     _context = context;
     if (_context.Auctions.Count() == 0)
     {
         _context.Auctions.Add(new Auction {
             Name = "Item2", UserId = "2", InitialValue = (long)1200.00, WasUsed = "false"
         });
         _context.SaveChanges();
     }
     _appSettings = appSettings.Value;
     _auctions.AddRange(_context.Auctions.ToList());
 }
Exemple #4
0
 public void Add(AuctionBid auctionBid)
 {
     _context.AuctionBids.Add(auctionBid);
     _context.SaveChanges();
 }
Exemple #5
0
 public void Add(User user)
 {
     _context.Users.Add(user);
     _context.SaveChanges();
 }
Exemple #6
0
 public void Add(Auction auction)
 {
     _context.Auctions.Add(auction);
     _context.SaveChanges();
 }