47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Housewives.Api.Data;
|
|
using Housewives.Api.Entities;
|
|
using Housewives.Api.Repositories.Contracts;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Housewives.Api.Repositories
|
|
{
|
|
public class HousewifeRepository : IHousewifeRepository
|
|
{
|
|
private readonly HousewivesDbContext housewivesDbContext;
|
|
|
|
public HousewifeRepository(HousewivesDbContext housewivesDbContext)
|
|
{
|
|
this.housewivesDbContext = housewivesDbContext;
|
|
}
|
|
public Task<Housewife> GetHousewife(int id)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public async Task<IEnumerable<Housewife>> GetHousewives()
|
|
{
|
|
var housewives = await this.housewivesDbContext.Housewives.ToListAsync();
|
|
return housewives;
|
|
}
|
|
|
|
public Task<Quote> GetQuote(int id)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public async Task<IEnumerable<Quote>> GetQuotes()
|
|
{
|
|
var quotes = await this.housewivesDbContext.Quotes.ToListAsync();
|
|
return quotes;
|
|
}
|
|
|
|
public async Task<IEnumerable<Quote>> GetQuotesById(int housewifeId)
|
|
{
|
|
var quotes = await (from quote in housewivesDbContext.Quotes
|
|
where quote.HousewifeId == housewifeId
|
|
select quote).ToListAsync();
|
|
return quotes;
|
|
}
|
|
}
|
|
}
|