I've started reading NerdDinner tutorial from scratch. While reading and coding application I came to part about some Helper methods and there was one example of some class (AddRuleViolations) but there was no any explanation WHERE to add this class. So I skipped this one and continued with tutorial without using this class later in code.
Now, I am stuck at "Adding page navigation UI" section where this helper method is in use again. So, I downloaded their final code and I see that there is folder "Helpers" and these classes that I need to implement in my code. Thing is that I don't want to do copy/paste and I want to understand how to add this helper methods.
Specifically, I want to add this class as helper method:
public class PaginatedList<T> : List<T>
{
public int PageIndex { get; private set; }
public int PageSize { get; private set; }
public int TotalCount { get; private set; }
public int TotalPages { get; private set; }
public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize)
{
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = source.Count();
TotalPages = (int)Math.Ceiling(TotalCount / (double)PageSize);
this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize));
}
public bool HasPreviousPage
{
get
{
return (PageIndex > 0);
}
}
public bool HasNextPage
{
get
{
return (PageIndex + 1 < TotalPages);
}
}
}
Problem is that I don't have any experience with .net or C# and I'm not familiar with developing applications in VS. (I know only some basics of C#)
Thanks,
Ile