public ActionResult ChildRemove(int key) { Employee1Details.GetAllRecords().Remove(Employee1Details.GetAllRecords().Where(or => or.EmployeeID == key).FirstOrDefault()); var data = Employee1Details.GetAllRecords(); return(Json(new { result = data, count = data.Count })); }
public ActionResult ChildInsert(CRUDModel2 myObject) { var ord = myObject.Value; Employee1Details.GetAllRecords().Insert(0, ord); return(Json(myObject.Value)); }
public ActionResult ChildDatasource(DataManagerRequest dm) { IEnumerable DataSource = Employee1Details.GetAllRecords().ToList(); DataOperations operation = new DataOperations(); if (dm.Search != null && dm.Search.Count > 0) { DataSource = operation.PerformSearching(DataSource, dm.Search); //Search } if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting { DataSource = operation.PerformSorting(DataSource, dm.Sorted); } if (dm.Where != null && dm.Where.Count > 0) //Filtering { DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); } int count = DataSource.Cast <Employee1Details>().Count(); if (dm.Skip != 0) { DataSource = operation.PerformSkip(DataSource, dm.Skip); //Paging } if (dm.Take != 0) { DataSource = operation.PerformTake(DataSource, dm.Take); } return(dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource)); }
public ActionResult ChildUpdate(CRUDModel2 myObject) { var ord = myObject.Value; Employee1Details val = Employee1Details.GetAllRecords().Where(or => or.EmployeeID == ord.EmployeeID).FirstOrDefault(); val.EmployeeID = ord.EmployeeID; val.FirstName = ord.FirstName; val.LastName = ord.LastName; val.ReportsTo = ord.ReportsTo; return(Json(myObject.Value)); }