public static void Initialize(ItemDbContext context) { if (context.Items.Any()) { return; } context.Database.EnsureCreated(); for (var i = 1; i <= 20; i++) { var item = new Item { Name = $"Item {i}", Code = $"Code {i}", Active = true, Clasifications = new List <Clasification> { new Clasification { Name = $"Clasification {i}" } }, }; context.Items.Add(item); } context.SaveChanges(); }
public async Task <Item> GetItemAsync(int id) { using (var context = new ItemDbContext()) { //.Include(x => x.Address).ToList(); return(await context.FindAsync <Item>(id)); } }
public ItemWorkflowController(ILogger <ItemWorkflowController> logger, IPersistenceProvider workflowStore, IWorkflowController workflowService, ItemDbContext itemDbContext) { _workflowService = workflowService; _workflowStore = workflowStore; _logger = logger; _itemDbContext = itemDbContext; }
public async Task <IEnumerable <Item> > GetItemsAsync(bool forceRefresh = false) { using (var context = new ItemDbContext()) { return(await context.Items.ToListAsync()); //var items = await context.Items.ToList(); //return await Task.FromResult(items); } }
public async Task <bool> UpdateItemAsync(Item item) { int count = 0; using (var context = new ItemDbContext()) { context.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Modified; count = await context.SaveChangesAsync(); } return(await Task.FromResult(count == 1)); }
public async Task <bool> DeleteItemAsync(int id) { int count = 0; using (var context = new ItemDbContext()) { var item = context.Items.Where(p => p.Id == id).FirstOrDefault(); context.Remove <Item>(item); //context.Items.Remove(item); count = await context.SaveChangesAsync(); } return(await Task.FromResult(count == 1)); }
public ServiceRepository(ItemDbContext context, IPastPriceRepository pastPriceRepository) { this.context = context; this.pastPriceRepository = pastPriceRepository; }
public ItemController(ILogger <ItemController> logger, ItemDbContext itemDbContext) { _logger = logger; _itemDbContext = itemDbContext; }
public ItemsController(ItemDbContext dbContext) { _dbContext = dbContext; DataBaseInitializer.Initialize(_dbContext); }
public GangJinViewComponent(ItemDbContext db, ISampleUcControler service1) { this.db = db; sampleUcControler = service1; }
public HomeController(ItemDbContext context) { _context = context; }
public PastPriceRepository(ItemDbContext context) { this.context = context; }
public ItemPageModel(ItemDbContext db) { this.db = db; }
public AccountController() { _context = new AssetsDbContext(); _itemContext = new ItemDbContext(); _publisherContext = new PublisherModelContext(); }
public AssetsController() { _context = new AssetsDbContext(); _photoContext = new PictureDbContext(); _itemContext = new ItemDbContext(); }
public CategoryController(ItemDbContext dbContext) { context = dbContext; }
public PricingAutoAssign(ILogger <PricingAutoAssign> logger, ItemDbContext itemDbContext) { _logger = logger; _itemDbContext = itemDbContext; }
public DefaultSampleConsignService(ItemDbContext db) { this.db = db; }
public NewItem(ILogger <NewItem> logger, ItemDbContext itemDbContext) { _logger = logger; _itemDbContext = itemDbContext; }
public SamplePageModel(ItemDbContext db) { this.db = db; }
public ItemsController(ItemDbContext context) { _context = context; }
public ProcessApproval(ILogger <NewItem> logger, ItemDbContext itemDbContext) { _logger = logger; _itemDbContext = itemDbContext; }