public ActionResult CreateJson([DataSourceRequest] DataSourceRequest request, Cats.Models.Hubs.HubView viewModel) { if (viewModel != null && ModelState.IsValid) { Cats.Models.Hubs.Hub original = new Cats.Models.Hubs.Hub { Name = viewModel.Name, HubOwnerID = viewModel.HubOwnerID }; _hubService.AddHub(original); } return(Json(new[] { viewModel }.ToDataSourceResult(request, ModelState))); }
public ActionResult DeleteJson([DataSourceRequest] DataSourceRequest request, Cats.Models.Hubs.HubView viewModel) { var original = _hubService.FindById(viewModel.HubId); _hubService.DeleteHub(original); return(Json(new[] { viewModel }.ToDataSourceResult(request, ModelState))); }
public ActionResult UpdateJson([DataSourceRequest] DataSourceRequest request, Cats.Models.Hubs.HubView viewModel) { if (viewModel != null && ModelState.IsValid) { var original = _hubService.FindById(viewModel.HubId); original.Name = viewModel.Name; original.HubOwnerID = viewModel.HubOwnerID; _hubService.EditHub(original); } return(Json(new[] { viewModel }.ToDataSourceResult(request, ModelState))); }