private async Task SeedData(AuctionDbContext context) { context.Cities.Add(GetDummyCity()); context.AuctionHouses.Add(GetDummyAuctionHouse()); context.AddRange(GetDummyData()); await context.SaveChangesAsync(); }
private void InitSQL(string name, string location) { string filePath = Path.Combine(location, string.Format("{0}.{1}", name, "mdf")); AuctionDbContext db = new AuctionDbContext(_folderMVC, filePath); db.Initial(); }
private async Task SeedData(AuctionDbContext context) { context.Users.Add(SeedUser()); context.AddRange(GetDummyData()); context.AddRange(GetDummyReceipts()); await context.SaveChangesAsync(); }
public void SeedAdminRole(AuctionDbContext context) { var store = new RoleStore<IdentityRole>(context); var manager = new RoleManager<IdentityRole>(store); var role = new IdentityRole { Name = "Admin" }; manager.Create(role); }
public HomeController(AuctionDbContext _db) { db = _db; layoutVM = new LayoutViewModel() { CategoriesVM = RecursiveMenu.GetRecursiveMenu(db) }; }
public TraderManager( UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, AuctionDbContext dbContext) { _userManager = userManager; _roleManager = roleManager; _dbContext = dbContext; }
public ItemController(AuctionDbContext _db, IWebHostEnvironment hostEnvironment) { db = _db; webHostEnvironment = hostEnvironment; layoutVM = new LayoutViewModel() { CategoriesVM = RecursiveMenu.GetRecursiveMenu(db) }; }
public void GetCarFromDBTest() { //Arrange var context = new AuctionDbContext("DefaultConnection"); var db = context; CarsRepository tmp = new CarsRepository(context); Assert.AreEqual(tmp.GetAll(), db.Cars); }
public void GetAllUnCheckedFromDBTest() { //Arrange var context = new AuctionDbContext("DefaultConnection"); var db = context; CarsRepository tmp = new CarsRepository(context); var target = db.Cars.Where(item => item.IsCheck == false); Assert.IsNotNull(target); }
public void GetAllSedansFromDBTest() { //Arrange var context = new AuctionDbContext("DefaultConnection"); var db = context; CarsRepository tmp = new CarsRepository(context); var target = db.Cars.Where(item => item.CategoryId == 1); Assert.IsNotNull(target); }
public ItemService(AuctionDbContext context, ICloudinaryService cloudinaryService, IUserService userService, IReceiptService receiptService) { this.context = context; this.cloudinaryService = cloudinaryService; this.userService = userService; this.receiptService = receiptService; }
public AccountController(IConfiguration _configuration, AuctionDbContext _db, ILogger <AccountController> logger, IHttpContextAccessor httpContextAccessor, IWebHostEnvironment hostEnvironment) { _logger = logger; webHostEnvironment = hostEnvironment; _httpContextAccessor = httpContextAccessor; db = _db; configuration = _configuration; layoutVM = new LayoutViewModel() { CategoriesVM = RecursiveMenu.GetRecursiveMenu(db) }; }
public void SeedUsers(AuctionDbContext context) { var store = new UserStore<User>(context); var manager = new UserManager<User>(store); User admin = new User { UserName = "******", Email = "*****@*****.**", FirstName = "Tosho", LastName = "Ivanov", PhoneNumber = "+3591234569", SecurityStamp = Guid.NewGuid().ToString(), PasswordHash = this.hasher.HashPassword("1"), }; User pesho = new User { UserName = "******", Email = "*****@*****.**", FirstName = "Pesho", LastName = "Goshov", PhoneNumber = "+3591234567", SecurityStamp = Guid.NewGuid().ToString(), PasswordHash = this.hasher.HashPassword("1"), }; User gosho = new User { UserName = "******", Email = "*****@*****.**", FirstName = "Gosho", LastName = "Toshov", PhoneNumber = "+3591234568", SecurityStamp = Guid.NewGuid().ToString(), PasswordHash = this.hasher.HashPassword("1"), }; this.Users.Add(pesho); this.Users.Add(gosho); this.Users.Add(admin); context.Users.AddOrUpdate(this.Users.ToArray()); context.SaveChanges(); var adminId = context.Users.FirstOrDefault(u => u.UserName == "*****@*****.**").Id; manager.AddToRole(adminId, "Admin"); context.SaveChanges(); }
public UnitOfWork( AuctionDbContext dbContext, IBidRepo bidRepo, ICategoryRepo categoryRepo, IItemRepo itemRepo, IOrderRepo orderRepo, IPaymentRepo paymentRepo ) { _dbContext = dbContext; _bidRepo = bidRepo; _categoryRepo = categoryRepo; _itemRepo = itemRepo; _orderRepo = orderRepo; _paymentRepo = paymentRepo; }
public static List <CategoryVM> GetRecursiveMenu(AuctionDbContext db) { //Recursive List <Category> category = new List <Category>(); List <Category> categories = db.Categories.OrderByDescending(c => c.Children.Any()).ToList(); category = categories .Where(c => c.ParentId == null) .Select(c => new Category() { Id = c.Id, Name = c.Name, ParentId = c.ParentId, Children = GetChildren(categories, c.Id) }).ToList(); return(CategoryUtility.MapModelsToVMs(category)); }
public void SeedItems(AuctionDbContext context) { Array enumValuesArray = Enum.GetValues(typeof(ItemType)); for (var i = 0; i < 10; i++) { var rand = this.random.Next(0, 7); var item = new Item { Title = string.Format("Item {0}", i), Author = string.Format("Pablo{0} Picasso{1}", i, i), Description = "Description" + i, Type = (ItemType)enumValuesArray.GetValue(rand) }; this.Items.Add(item); } context.Items.AddOrUpdate(this.Items.ToArray()); context.SaveChanges(); }
public NotifiedExpiredItemController(AuctionDbContext _db) { db = _db; }
public OrderRepo(AuctionDbContext db) : base(db) { }
public BidRepo(AuctionDbContext db) : base(db) { }
public Startup() { this.db = new AuctionDbContext(); }
public UserService(AuctionDbContext context) { this.context = context; }
public void SeedAuctions(AuctionDbContext context) { for (var i = 0; i < 10; i++) { var randUser = this.random.Next(0, 3); var items = new List<Item> { this.Items[i] }; var bidders = this.Users; var auction = new Auction { Name = "Auction " + i, DateOfAuction = DateTime.UtcNow.AddHours(24 + (24 * i)), Active = false, InitialPrice = 10000 + 1000 * i, BidStep = 500, Items = items, //Creator = this.Users[randUser], Bidders = bidders }; this.Auctions.Add(auction); } context.Auctions.AddOrUpdate(this.Auctions.ToArray()); context.SaveChanges(); }
public UnitOfWork(AuctionDbContext db) { _db = db; }
public AuctionRoom(IBidsServices bidService) { this.bids = bidService; this.db = new AuctionDbContext(); }
public ArtworksRepository(AuctionDbContext context) { _context = context; }
public UserRepository(AuctionDbContext db) { _db = db; }
public PaymentRepo(AuctionDbContext db) : base(db) { }
public CategoryRepo(AuctionDbContext db) : base(db) { }
public OffersRepository(AuctionDbContext context) { _context = context; }
public BidService(AuctionDbContext context, IUserService userService) { this.context = context; this.userService = userService; }
public CategoryRepository(AuctionDbContext db) { _db = db; }
public ArtWorksController(AuctionDbContext context, IHostingEnvironment hostingEnvironment) { _context = context; this.hostingEnvironment = hostingEnvironment; }
public AuctionService(AuctionDbContext context, IHttpContextAccessor httpContextAccessor) : base(context, httpContextAccessor) { }
public ReceiptService(AuctionDbContext context) { this.context = context; }
public AuctionRepository(AuctionDbContext context) : base(context) { }
public BidController(AuctionDbContext _db) { db = _db; }