Beispiel #1
0
        public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            if (model != null) // && ModelState.IsValid
            {
                this.data.Pages.Delete(model.Id.Value);
                this.data.SaveChanges();
            }

            return(this.GridOperation(model, request));
        }
Beispiel #2
0
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            var dbModel = base.Create <Model>(model);

            if (dbModel != null)
            {
                model.Id = dbModel.Id;
            }

            return(this.GridOperation(model, request));
        }
Beispiel #3
0
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, ViewModel model)
        {
            if (model != null)
            {
                var dbModel = this.Find <Model>(model.Id);
                Mapper.Map(model, dbModel);
                this.data.SaveChanges();
                model.Id = dbModel.Id;
            }

            // base.Update<Model, ViewModel>(model, model.Id.Value);
            return(this.GridOperation(model, request));
        }