public HomeController() { if (_rep == null) { _rep = new Rep(); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IRep rep) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); //app.UseMiddleware<SchedulerMiddleware>(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); //var something = rep.GetSch(); // app.Run(async (context) => // { // // await context.Response.WriteAsync("Hello"); // await context.Response.WriteAsync(something.ToString()); // }); }
/// <summary> /// Converte dal entity to entity on bal /// </summary> /// <param name="entity">entity to be converted</param> /// <returns>bal entity</returns> public static PurchaseEntity ToBalPurchase(this DALPurchase purchase, IRep <DALProduct> context) { var pr = context; return(new PurchaseEntity() { BuyerName = purchase.BuyerName, Products = pr.GetAll().Where(i => i.Buyer == purchase.BuyerName).Select(i => i.ToBalProduct()).ToList() }); }
/// <summary> /// creating serviece /// </summary> /// <param name="pr">product repository</param> /// <param name="purch">purchase repository</param> /// <exception cref="ArgumentNullException">Thrown when one of reposityies is null</exception> public ShopService(IRep <DALProduct> pr, IRep <DALPurchase> purch) { if (pr == null) { throw new ArgumentNullException("Product repository wasn't found"); } if (purch == null) { throw new ArgumentNullException("Purchase repository wasn't found"); } productService = pr; purchaseService = purch; }
public Ctrl(IRep repo, int flag) { this.repo = repo; this.flag = flag; }
public TestApiController(IRep <Player> players) { this.player = players; }
public DataParser(IRep rep) { _rep = rep; List = _rep.GetSch(); }