public ActionResult UrlDatasource(Data dm)
{
var order = OrdersDetails.GetAllRecords();
var Data = order.ToList();
int count = order.Count();
// we have serialize the json object using newtonsoft
var SerializeData = Newtonsoft.Json.JsonConvert.SerializeObject(Data);
return dm.requiresCounts ? Json(new { result = SerializeData.Skip(dm.skip).Take(dm.take), count = count }): Json(SerializeData);
}
}
public class OrdersDetails
{
public OrdersDetails()
{
}
public OrdersDetails(int OrderID, string CustomerId, int EmployeeId, double Freight, bool Verified, DateTime OrderDate, string ShipCity, string ShipName, string ShipCountry, DateTime ShippedDate, string ShipAddress, state State)
{
. . . . .
this.ShipAddress = ShipAddress;
this.State = State;
}
public int? OrderID { get; set; }
public string CustomerID { get; set; }
. . . . .
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public state State { get; }
}
public enum state
{
[Display(Name = "Activated")]
Activated = 1,
[Display(Name = "Unactivated")]
Unactivated,
}
|