예제 #1
0
 public ActionResult Edit(int id, TrainerTestEditViewModel viewModel)
 {
     if (viewModel.Id == id)
     {
         if (ModelState.IsValid)
         {
             var test = new Test
             {
                 Id = viewModel.Id,
                 Name = viewModel.Name,
             };
             testService.EditTest(test);
             return Redirect("/trainer/test");
         }
         return View(viewModel);
     }
     else
     {
         throw new Exception("Dont do this");
     }
 }
예제 #2
0
 public ActionResult Edit(int id)
 {
     var test = testService.GetTest(id);
     var viewModel = new TrainerTestEditViewModel
     {
         Id = test.Id,
         Name = test.Name,
     };
     return View(viewModel);
 }