예제 #1
0
        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
        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;
            }
        }