I have a class like this:
public class BE_CategoryBase
{
public Int32 CategoryID { get; set; }
public String CategoryName
{
get;
set;
}
public String CategorySanitized { get; set; }
public Boolean IsActive { get; set; }
public DateTime? ModificationDate { get; protected set; }
public Int64? ModifiedBy { get; set; }
}
In the Web API I have Action Method like this.
So far I am fetching all records from the server in single request. The above API call is Post because there are many filters being used. As the Get has limited length in query string...so I used Post.
[Route("api/v1/CategoryList"), HttpPost]
public async Task<IHttpActionResult> CategoryList([FromBody]BE_Category obj)
{
var result = await _category.CategoryList(obj);
if (!string.IsNullOrEmpty(result.Key))
await _log.CreateLog(new BE_Logs { Message = result.Key });
return Ok(new { ErrorMessage = result.Key, result = result.Value });
}
Now, In order to use Paging, I was thinking of adding startPage and PageSize columns in the BE_CategoryBase class. As I am using Entity Framework Code First, adding the column in the class will add these columns in Database Table also.
Is there any elegant way to implement paging with Post Action Method ?