InventoryController ConfigureDependency(IServiceProvider serviceProvider, SimpleInventoryContext simpleInvetoryContext) { //Func<Option<IEnumerable<Item>>> getall=>simpleInvetoryContext.Items.Any()?Some<Option<IEnumerable<Item>>>(simpleInvetoryContext.Items.AsEnumerable()):None; Func <Option <IEnumerable <Item> > > getAllItems = () => simpleInvetoryContext.Items; //simpleInvetoryContext.Items.Any() ? Some(simpleInvetoryContext.Items.AsEnumerable()) : None; Func <int, Option <Item> > getItemByID = id => simpleInvetoryContext.Items.SingleOrDefault(x => x.Id == id); return(new InventoryController(getAllItems, getItemByID)); }
public LookupController(SimpleInventoryContext context, IOptionsSnapshot <SimpleInventorySettings> settings) { _SimpleInventoryContext = context; _Settings = settings; string url = _Settings.Value.ExternalCodeSetBaseUrl; //prevent context to track modified record ((DbContext)_SimpleInventoryContext).ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; }
public InventoryBusinessRepo( Func <Option <IEnumerable <Item> > > getallItems, Func <long, Option <Item> > getItemByID, Func <string, Option <IEnumerable <Item> > > getItemByName, Func <int, Option <IEnumerable <Code_Value> > > getAllItemCategoriesType, Func <Option <IEnumerable <Supplier> > > getAllSuppliers, SimpleInventoryContext simpledbcontext ) { GetAllItems = getallItems; GetItemByID = getItemByID; GetItemByName = getItemByName; GetAllItemCategoriesType = getAllItemCategoriesType; GetAllSuppliers = getAllSuppliers; _simpleDBContext = simpledbcontext; }