DataTables_Obaigbona_Joel 1.0.1.1

This package takes care of many serverside functionality for the datatable.js. It includes dynamic searching, sorting, filtering, e.t.c. This package does not contain the datatables.js library, you are required to download it seperately and reference for your view page/client side. See the documentation section on  https://www.nuget.org/packages/DataTables_Obaigbona_Joel/  for information on how to use.

Install-Package DataTables_Obaigbona_Joel -Version 1.0.1.1
dotnet add package DataTables_Obaigbona_Joel --version 1.0.1.1
<PackageReference Include="DataTables_Obaigbona_Joel" Version="1.0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DataTables_Obaigbona_Joel --version 1.0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

How to use
//I Added "GetOptionResponseWithSpecAndCriteria(DataTableOptions options, ISpecification<T> spec)" for both WHERE and INCLUDE clauses in this version
//I don't know if anyone is really using this code, but if you would like me to upload all of it on github, please send me an email oseobaigbona@gmail.com
//PageContent is your model class and context is your dbcontext the baseSpecification can take all your include statement and where statements
protected IRepo<PageContent> PageContentRepo;
PageContentRepo = new RepoService<PageContent>(context);

//OnGet Version
public async Task<IActionResult> OnGetDTResponseAsync(DataTableOptions options){
var specs = new BaseSpecification<PageContent>(e => e.WebPage, e => e.ContentType);
var finalresult = await PageContentRepo.GetOptionResponseWithSpec(options, specs);
return new JsonResult(finalresult);
}

//OnPost Version
public async Task<IActionResult> OnPostDTResponseAsync()
{
MemoryStream stream = new MemoryStream();
Request.Body.CopyTo(stream);
stream.Position = 0;
using (StreamReader reader = new StreamReader(stream))
{
string requestBody = reader.ReadToEnd();
if (requestBody.Length > 0)
{
DataTableOptions options = JsonConvert.DeserializeObject<DataTableOptions>(requestBody);
if (options != null)
{
try
{
var specs = new BaseSpecification<PageContent>(e => e.WebPage, e => e.ContentType);
var finalresult = await PageContentRepo.GetOptionResponseWithSpec(options, specs);
return new JsonResult(finalresult);
}
catch (Exception e)
{
_logger.LogError("Error Occurred While Running GetOptions @ CMS IndexModel : \n" + e.Message);
return BadRequest();
}
}
}
}
_logger.LogError(@"Error Occurred While Running GetOptions @ CMS IndexModel : \n" + "requestBody Length was not greater than 0");
return BadRequest();
}

How to use
//I Added "GetOptionResponseWithSpecAndCriteria(DataTableOptions options, ISpecification<T> spec)" for both WHERE and INCLUDE clauses in this version
//I don't know if anyone is really using this code, but if you would like me to upload all of it on github, please send me an email oseobaigbona@gmail.com
//PageContent is your model class and context is your dbcontext the baseSpecification can take all your include statement and where statements
protected IRepo<PageContent> PageContentRepo;
PageContentRepo = new RepoService<PageContent>(context);

//OnGet Version
public async Task<IActionResult> OnGetDTResponseAsync(DataTableOptions options){
var specs = new BaseSpecification<PageContent>(e => e.WebPage, e => e.ContentType);
var finalresult = await PageContentRepo.GetOptionResponseWithSpec(options, specs);
return new JsonResult(finalresult);
}

//OnPost Version
public async Task<IActionResult> OnPostDTResponseAsync()
{
MemoryStream stream = new MemoryStream();
Request.Body.CopyTo(stream);
stream.Position = 0;
using (StreamReader reader = new StreamReader(stream))
{
string requestBody = reader.ReadToEnd();
if (requestBody.Length > 0)
{
DataTableOptions options = JsonConvert.DeserializeObject<DataTableOptions>(requestBody);
if (options != null)
{
try
{
var specs = new BaseSpecification<PageContent>(e => e.WebPage, e => e.ContentType);
var finalresult = await PageContentRepo.GetOptionResponseWithSpec(options, specs);
return new JsonResult(finalresult);
}
catch (Exception e)
{
_logger.LogError("Error Occurred While Running GetOptions @ CMS IndexModel : \n" + e.Message);
return BadRequest();
}
}
}
}
_logger.LogError(@"Error Occurred While Running GetOptions @ CMS IndexModel : \n" + "requestBody Length was not greater than 0");
return BadRequest();
}

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1.1 59 6/25/2019
1.0.1 50 6/21/2019
1.0.0 54 6/14/2019