28 lines
868 B
C#
28 lines
868 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using _0_Framework.InfraStructure;
|
|
using Company.Domain.FineSubjectAgg;
|
|
using CompanyManagment.App.Contracts.FineSubject;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace CompanyManagment.EFCore.Repository;
|
|
|
|
public class FineSubjectRepository : RepositoryBase<long, FineSubject>, IFineSubjectRepository
|
|
{
|
|
private readonly CompanyContext _companyContext;
|
|
public FineSubjectRepository(CompanyContext companyContext) : base(companyContext)
|
|
{
|
|
_companyContext = companyContext;
|
|
}
|
|
|
|
public List<FineSubjectViewModel> GetAll(long workshopId)
|
|
{
|
|
return _companyContext.FinesSubject.Where(x => x.WorkshopId == workshopId).Select(x => new FineSubjectViewModel()
|
|
{
|
|
Id = x.id,
|
|
Subject = x.Title,
|
|
Amount = x.Amount
|
|
|
|
}).ToList();
|
|
}
|
|
} |