コード例 #1
0
 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)));
 }
コード例 #2
0
        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)));
        }
コード例 #3
0
 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)));
 }