public ActionResult Edit(icdtTestModel icdtTestModel) { //if (newsModel.News_StartTime >= newsModel.News_EndTime) //{ // ModelState.AddModelError(String.Empty, "結束時間不得小於開始時間"); // return View(newsModel); //} if (ModelState.IsValid) { try { icdtTest icdtTestItem = this.ModelToDomain(icdtTestModel); icdtTestManager.Update(icdtTestItem); TempData["SaveOk"] = true; } catch(Exception) { TempData["SaveOk"] = false; } } return View("~/Views/Admin/icdtTests/Edit.cshtml",icdtTestModel); }
private icdtTestModel DomainToModel(icdtTest icdtTest) { icdtTestModel viewModel = new icdtTestModel(); viewModel = AutoMapperConfig.Mapper.Map<icdtTest, icdtTestModel>(icdtTest); return viewModel; }
public ActionResult Create() { var newItem = new icdtTestModel(); return View("~/Views/Admin/icdtTests/Create.cshtml", newItem); }
private icdtTest ModelToDomain(icdtTestModel viewModel) { icdtTest icdtTest = new icdtTest(); icdtTest = AutoMapperConfig.Mapper.Map<icdtTestModel, icdtTest>(viewModel); return icdtTest; }