예제 #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));
        }
예제 #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));
        }
예제 #3
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)));
        }
예제 #4
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)));
        }
예제 #5
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)));
        }
예제 #6
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));
        }