コード例 #1
0
ファイル: VideoController.cs プロジェクト: patrickwensel/WS
        public ActionResult GroupCreate([DataSourceRequest] DataSourceRequest request, GroupViewModel groupViewModel)
        {
            try
            {
                if (groupViewModel != null && ModelState.IsValid)
                {
                    using (var context = new ASJDE())
                    {
                        var videoGroup = new VideoGroup
                        {
                            VideoAreaID = groupViewModel.AreaID,
                            Name        = groupViewModel.Name,
                        };

                        context.VideoGroups.Add(videoGroup);
                        context.SaveChanges();

                        groupViewModel.ID = videoGroup.ID;
                    }
                }

                return(Json(new[] { groupViewModel }.ToDataSourceResult(request, ModelState)));
            }
            catch (Exception e)
            {
                Logger.Error("Exception", e);
                return(null);
            }
        }
コード例 #2
0
ファイル: VideoController.cs プロジェクト: patrickwensel/WS
        public ActionResult GroupCreate([DataSourceRequest] DataSourceRequest request, GroupViewModel groupViewModel)
        {
            try
            {
                if (groupViewModel != null && ModelState.IsValid)
                {
                    using (var context = new ASJDE())
                    {
                        var videoGroup = new VideoGroup
                            {
                                VideoAreaID = groupViewModel.AreaID,
                                Name = groupViewModel.Name,
                            };

                        context.VideoGroups.Add(videoGroup);
                        context.SaveChanges();

                        groupViewModel.ID = videoGroup.ID;
                    }
                }

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

            }
            catch (Exception e)
            {
                Logger.Error("Exception", e);
                return null;
            }
        }