Commit fdc4e589 authored by hasan khaddour's avatar hasan khaddour

add specified repositories

parent ae1463e6
using ApplicationDomain.Entities;
using ApplicationDomain.Repositories;
using ApplicationDomain.Specification;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Infrastructure.Repository
{
public class IngredientRepository : GenericRepository<Ingredient>, IIngredientRepository
{
public IngredientRepository(DbContext dbContext) : base(dbContext)
{
}
public async Task<IEnumerable<Ingredient>> GetByName(String Name)
{
var spec = new IngredientWithMedicinesSpecification();
spec.Criteria = p => p.Name == Name;
IQueryable<Ingredient> queryable = _table;
queryable = GetQuery(queryable, spec);
return await queryable.ToListAsync();
}
}
}
using ApplicationDomain.Entities; using ApplicationDomain.Abstraction;
using ApplicationDomain.Entities;
using ApplicationDomain.Repositories; using ApplicationDomain.Repositories;
using ApplicationDomain.Specification; using ApplicationDomain.Specification;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -18,7 +18,7 @@ namespace Infrastructure.Repository ...@@ -18,7 +18,7 @@ namespace Infrastructure.Repository
public Task<IEnumerable<Medicine>> GetByMedicalState(int medicalStateId) public Task<IEnumerable<Medicine>> GetByMedicalState(int medicalStateId)
{ {
var spec = new MedicineIngredientSpecification(); var spec = new MedicineWithIngredientsSpecification();
spec.Criteria = p => p.MedicalStates.All(s=>s.Id ==medicalStateId ); spec.Criteria = p => p.MedicalStates.All(s=>s.Id ==medicalStateId );
......
using ApplicationDomain.Entities;
using ApplicationDomain.Repositories;
using ApplicationDomain.Specification;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading.Tasks;
namespace Infrastructure.Repository
{
public class PatientRepository : GenericRepository<Patient>, IPatientRepository
{
public PatientRepository(DbContext dbContext) : base(dbContext)
{
}
public async Task<Patient> GetByUserId(string userId)
{
var spec = new PatientWithMedicinesSpecification();
spec.Criteria = p => p.User.Id == userId;
IQueryable<Patient> queryable = _table;
queryable = GetQuery(queryable, spec);
return await queryable.FirstOrDefaultAsync();
}
}
}
35cbfd0c81bb22b7edd15e31ee71ff49ee100adb ba80f8fbd17b5cd8f1231031e8a9c92aca903458
...@@ -5,7 +5,9 @@ C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\Infrastructure.dll ...@@ -5,7 +5,9 @@ C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\Infrastructure.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ref\Infrastructure.dll C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ref\Infrastructure.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\Infrastructure.pdb C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\Infrastructure.pdb
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationCore.dll C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationCore.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationDomain.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationCore.pdb C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationCore.pdb
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationDomain.pdb
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.csproj.AssemblyReference.cache C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.csproj.AssemblyReference.cache
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.GeneratedMSBuildEditorConfig.editorconfig C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.AssemblyInfoInputs.cache C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.AssemblyInfoInputs.cache
...@@ -16,5 +18,3 @@ C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.dll ...@@ -16,5 +18,3 @@ C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\ref\Infrastructure.dll C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\ref\Infrastructure.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.pdb C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.pdb
C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.genruntimeconfig.cache C:\Users\HASAN\Desktop\Medic\Infrastructure\obj\Debug\net5.0\Infrastructure.genruntimeconfig.cache
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationDomain.dll
C:\Users\HASAN\Desktop\Medic\Infrastructure\bin\Debug\net5.0\ApplicationDomain.pdb
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment