>>>>var clients = Db.Clients;>>>>
>>>>private JsonResult CreateFlexiJson(IEnumerable<JobPost> items, int page, int total)>>>>
>>>private JsonResult CreateFlexiJson(IEnumerable<JobPost> items, int page, int total, ??? clients = null)>>
>>private JsonResult CreateFlexiJson(IEnumerable<Client> items, int page, int total) >> { >> return Json( >> new >> { >> page, >> total, >> rows = >> items >> .Select(x => >> new >> { >> id = x.Id, >> // either use GetPropertyList(x) method to get all columns >> cell = new { Id = x.Id, Number = x.Number, Name = x.Name, Contact1 = x.Contact1.Contact ?? String.Empty } >> }) >> }, JsonRequestBehavior.AllowGet); >> }>>
namespace CardNumbers.Models { public class ClientViewModel { public Client Client { get; set; } [Key] [Editable(false)] [Column("ClientId", TypeName = "int")] public virtual int? ClientId { get { if (Client == null) return null; else return Client.Id; } set { Client.Id = value ?? 0; } } [Required] [DisplayName("Client No")] [UIHint("Number")] [Column("client_no", TypeName = "smallint")] [Remote("doesClientNoExist", "Client", HttpMethod = "POST", AdditionalFields = "ClientId", ErrorMessage = "Client Number already exists. Please enter a different Client Number.")] public virtual Int16 Number { get { if (Client == null) return 0; else return Client.Number; } set { Client.Number = value; } } [Required] [Column("client_name", TypeName = "varchar")] [DisplayName("Client Name")] [MaxLength(30, ErrorMessage = "Client Name should not be longer than 30 characters")] [MinLength(3, ErrorMessage = "Client Name is too short")] [Remote("doesClientNameExist", "Client", HttpMethod = "POST", AdditionalFields = "ClientId", ErrorMessage = "Client Name already exists. Please enter a different Client Name.")] public virtual string Name { get { if (Client == null) return ""; else return Client.Name; } set { Client.Name = value; } } public int id { get; set; } } }This class I am using in my ClientController already. So, I suspect I can have this signature instead
private JsonResult CreateFlexiJson(IEnumerable<ClientViewModel> items, int page, int total)Or can you clarify what exactly do you mean?