using AutoLot.Dal.EfStructures;
using AutoLot.Dal.Models.Entities;
using AutoLot.Dal.Repos.Base;
using AutoLot.Dal.Repos.Interfaces;
using Microsoft.EntityFrameworkCore;
Измените класс на public
, унаследуйте его от BaseRepo
, реализуйте ICreditRiskRepo
и добавьте два обязательных конструктора:
namespace AutoLot.Dal.Repos
{
public class CreditRiskRepo : BaseRepo
{
public CreditRiskRepo(ApplicationDbContext context) : base(context)
{
}
internal CreditRiskRepo(
DbContextOptions
: base(options)
{
}
}
}
Хранилище данных о заказчиках
Откройте файл класса CustomerRepo.cs
и поместите в его начало приведенные далее операторы using
:
using System.Collections.Generic;
using System.Linq;
using AutoLot.Dal.EfStructures;
using AutoLot.Dal.Models.Entities;
using AutoLot.Dal.Repos.Base;
using AutoLot.Dal.Repos.Interfaces;
using Microsoft.EntityFrameworkCore;
Измените класс на public
, унаследуйте его от BaseRepo
, реализуйте ICustomerRepo
и добавьте два обязательных конструктора:
namespace AutoLot.Dal.Repos
{
public class CustomerRepo : BaseRepo
{
public CustomerRepo(ApplicationDbContext context)
: base(context)
{
}
internal CustomerRepo(
DbContextOptions
: base(options)
{
}
}
}
Наконец, добавьте метод, который возвращает все записи Customer
с их заказами, отсортированные по значениям LastName
:
public override IEnumerable
=> Table
.Include(c => c.Orders)
.OrderBy(o => o.PersonalInformation.LastName);
Хранилище данных о производителях
Откройте файл класса MakeRepo.cs
и поместите в его начало перечисленные ниже операторы using
:
using System.Collections.Generic;
using System.Linq;
using AutoLot.Dal.EfStructures;
using AutoLot.Dal.Models.Entities;
using AutoLot.Dal.Repos.Base;
using AutoLot.Dal.Repos.Interfaces;
using Microsoft.EntityFrameworkCore;
Измените класс на public
, унаследуйте его от BaseRepo
, реализуйте IMakeRepo
и добавьте два обязательных конструктора:
namespace AutoLot.Dal.Repos
{
public class MakeRepo : BaseRepo
{
public MakeRepo(ApplicationDbContext context)
: base(context)
{
}
internal MakeRepo(
DbContextOptions
: base(options)
{
}
}
}
Переопределите методы GetAll()
, чтобы они сортировали значения Make
по названиям:
public override IEnumerable
=> Table.OrderBy(m => m.Name);
public override IEnumerable
=> Table.IgnoreQueryFilters().OrderBy(m => m.Name);
Хранилище данных о заказах
Откройте файл класса OrderRepo.cs
и поместите в его начало следующие операторы using
:
using AutoLot.Dal.EfStructures;
using AutoLot.Dal.Models.Entities;
using AutoLot.Dal.Repos.Base;
using AutoLot.Dal.Repos.Interfaces;
using Microsoft.EntityFrameworkCore;
Измените класс на public
, унаследуйте его от BaseRepo
и реализуйте IOrderRepo
:
namespace AutoLot.Dal.Repos
{
public class OrderRepo : BaseRepo
{
public OrderRepo(ApplicationDbContext context)
: base(context)
{
}
internal OrderRepo(
DbContextOptions
: base(options)
{
}
}
}