Beispiel #1
0
        public ActionResult DeleteModule(int?id)
        {
            TestModuleService.EnableTracking();
            var module = TestModuleService.GetByPK(id.Value);

            EditTestPermission(module.TestId);
            TestModuleService.DeleteAndSubmit(module);
            return(Json("ok"));
        }
Beispiel #2
0
        public ActionResult EditModule(int testId, int?id)
        {
            var module = new TestModule();

            if (id.HasValue)
            {
                EditTestPermission(testId);
                module = TestModuleService.GetByPK(id.Value);
            }
            else
            {
                module.TestId = testId;
            }
            return(BaseView(
                       new PagePart(new ModuleEditView().Init(module, Url).Get().ToString())));
        }
Beispiel #3
0
 public ActionResult EditModule(TestModule model)
 {
     if (!LinqToSqlValidator.Validate(ModelState, model))
     {
         return(ErrorJson());
     }
     EditTestPermission(model.TestId);
     TestModuleService.EnableTracking();
     if (model.Id == 0)
     {
         TestModuleService.InsertAndSubmit(model);
         return(UrlJson(Url.TestEdit().Urls.EditModule(model.TestId, model.Id)));
     }
     else
     {
         var module = TestModuleService.GetByPK(model.Id);
         module.Update(model, x => x.Name);
         TestModuleService.SubmitChanges();
     }
     return(Json("ok"));
 }