Exemplo n.º 1
0
        public virtual JsonResult Destroy([DataSourceRequest] DataSourceRequest request, DriveEventViewModel model)
        {
            if (model != null && this.ModelState.IsValid)
            {
                this.driveEvents.Delete(model.Id);
            }

            return this.Json(new[] { model }.ToDataSourceResult(request, this.ModelState));
        }
Exemplo n.º 2
0
        public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, DriveEventViewModel model)
        {
            if (model != null && this.ModelState.IsValid)
            {
                var currentUserId = this.User.Identity.GetUserId();
                var driveEvent = this.Mapper.Map<DriveEvent>(model);

                this.driveEvents.Create(driveEvent, currentUserId);
            }

            return this.Json(new[] { model }.ToDataSourceResult(request, this.ModelState));
        }
Exemplo n.º 3
0
        public virtual JsonResult Update([DataSourceRequest] DataSourceRequest request, DriveEventViewModel model)
        {
            if (model != null && this.ModelState.IsValid)
            {
                var driveEvent = this.Mapper.Map<DriveEvent>(model);
                this.driveEvents.Update(driveEvent);
            }

            return this.Json(new[] { model }.ToDataSourceResult(request, this.ModelState));
        }