Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in implementation in Generic repository pattern. #43

Open
vipjha opened this issue Aug 11, 2021 · 0 comments
Open

Problem in implementation in Generic repository pattern. #43

vipjha opened this issue Aug 11, 2021 · 0 comments

Comments

@vipjha
Copy link

vipjha commented Aug 11, 2021

How do I use if I am using generic repository pattern. If my code structure is like this and using GET Methods:

Controller:
[HttpGet]
public async Task GetAllTemplate()
{
List templates = await _emailTemplateService.GetAllTemplate();
return Ok(templates);
}

RepositoryServices for DTO:

public async Task<list> GetAllTemplate()
{
IEnumerable Templates = await _unitWork.TemplateRepositoryUnit.GetAllTemplate();
List TemplateDtos = new List();
foreach (Template Template in templates)
{
templateDtos.Add(new TemplateDto
{
EtId = template.EtId.ToString(),
TemplateName template.EtName,
});
}
return templateDtos;
}

Repository:

public async Task<ienumerable> GetAllTemplate()
{
return await FindByCondition(et => et.EtIsDeleted != true).ToListAsync();

}

Should I need to create "ToDataSourceResult" extension method or this will be also come with nuget package of dot net core, In my implementation it is showing some problems related to ToDataSourceResult.
And should I use this with GET method as well, because I am getting all data through the and showing on grid with angular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant