public async Task Init() { var options = new DbContextOptionsBuilder <MISDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; this.dbContext = new MISDbContext(options); var userService = new UserService(this.dbContext); var companyService = new CompanyService(this.dbContext, userService); var warehouseService = new WareHouseService(this.dbContext, companyService); var categoryService = new CategoryService(warehouseService, this.dbContext); var productService = new ProductService(this.dbContext, categoryService); this.receiptService = new ReceiptService(this.dbContext, userService, companyService, productService); var company = new Company() { Name = "asd", Address = "asd", }; await this.dbContext.AddAsync(company); await this.dbContext.SaveChangesAsync(); var warehouse = new WareHouse() { Name = "asd", Company = company, }; var user = new MISUser() { UserName = "******", Email = "*****@*****.**", FirstName = "asdddd", Company = company, LastName = "asdddd", }; await this.dbContext.AddAsync(warehouse); await this.dbContext.AddAsync(user); await this.dbContext.SaveChangesAsync(); var category = new Category() { Name = "asd", WareHouse = warehouse }; await this.dbContext.AddAsync(category); await this.dbContext.SaveChangesAsync(); }
/// <summary> /// 跳转主视图 /// </summary> /// <returns></returns> public ActionResult Index(string houseNo = null, string orderType = null) { var houses = new WareHouseService().GetList(); var refreshTime = Convert.ToInt32(ConfigurationManager.AppSettings["RefreshTime"]) * 1000; ViewBag.refreshTime = refreshTime; ViewBag.houseNo = houseNo == null ? "" : houseNo.ToString(); ViewBag.orderType = orderType == null ? "" : orderType.ToString(); return(View(houses)); }
public async Task Init() { var options = new DbContextOptionsBuilder <MISDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; this.dbContext = new MISDbContext(options); var userService = new UserService(this.dbContext); var companyService = new CompanyService(this.dbContext, userService); var company = await companyService.CreateAsync(CompanyName, CompanyAddress); var warehouseService = new WareHouseService(this.dbContext, companyService); var warehouse = await warehouseService.CreateAsync(WarehouseName, company.Id); this.categoryService = new CategoryService(warehouseService, this.dbContext); }
/// <summary> /// 跳转保存页面 /// </summary> /// <returns></returns> public ActionResult Form() { var houses = new WareHouseService().GetList(); return(View(houses)); }
public static IQueryable GetWareHouse() { return(WareHouseService.GetWareHouse()); }