public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                this.garageAdministrationService.Delete(model.Id);
            }

            return(this.GridOperation(model, request));
        }
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var dbModel = this.garageAdministrationService.Get(model.Id);
                Mapper.Map <ViewModel, Model>(model, dbModel);
                this.garageAdministrationService.Update(dbModel);
            }

            return(this.GridOperation(model, request));
        }
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                var dbmodel = Mapper.Map <Model>(model);

                this.garageAdministrationService.Create(dbmodel);
            }


            return(this.GridOperation(model, request));
        }
 protected JsonResult GridOperation(ViewModel model, [DataSourceRequest] DataSourceRequest request)
 {
     return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
 }