//Zwraca tablicę ebooków z danym autorem public static Ebook[] GetEbooksByAuthor(EbookShopContext context, Author author) { Ebook[] returnValue = context.Ebooks.Where( (e) => DoesEbookContainAuthor(e, author) ).ToArray(); return(returnValue); }
//Zwraca tablicę ebooków danej kategorii public static Ebook[] GetEbooksByCategory(EbookShopContext context, Category category) { Ebook[] returnValue = context.Ebooks.Where( (e) => DoesEbookContainCategory(e, category) ).ToArray(); return(returnValue); }
//Zwraca tablicę ebooków, w których tytule/nazwie kategorii/nazwie autora zawiera się dana fraza. public static Ebook[] GetEbooksByTextInAnyProperty(EbookShopContext context, string text) { List <Ebook> returnValue = new List <Ebook>(); Ebook[] temp = GetEbooksByTitle(context, text); returnValue.AddRange(temp); temp = context.Ebooks.Where( (e) => DoesEbookContainCategory(e, text) ).ToArray(); returnValue.AddRange(temp); temp = context.Ebooks.Where( (e) => DoesEbookContainAuthor(e, text) ).ToArray(); returnValue.AddRange(temp); return(returnValue.ToArray()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, EbookShopContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseDeveloperExceptionPage(); app.UseExceptionHandler("/Error"); app.UseHsts(); } EbookShopInitializer.Initialize(context, env); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); }
public SearchingService(EbookShopContext context) { this.context = context; }
public UserService(EbookShopContext appDbContext, IHttpContextAccessor httpContextAccessor, IMapper mapper) { _caller = httpContextAccessor.HttpContext.User; _appDbContext = appDbContext; _mapper = mapper; }
//Zwraca tablicę z ebookami, w których tytule zawiera się podana fraza public static Ebook[] GetEbooksByTitle(EbookShopContext context, string title) { Ebook[] returnValue = context.Ebooks.Where(e => e.Title.Contains(title)).ToArray(); return(returnValue); }
public RegistrationService(IMapper mapper, UserManager <AppUser> userManager, EbookShopContext context) { _mapper = mapper; _context = context; _userManager = userManager; }
public GetEbookListQueryHandler(EbookShopContext context, IMapper mapper) { this.context = context; this.mapper = mapper; }
/// <summary> /// /// </summary> /// <param name="context"></param> public EbookService(EbookShopContext context) { _context = context; }