コード例 #1
0
        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);
        }
コード例 #2
0
		private icdtTestModel DomainToModel(icdtTest icdtTest)
		{
		  icdtTestModel viewModel = new icdtTestModel();
            viewModel = AutoMapperConfig.Mapper.Map<icdtTest, icdtTestModel>(icdtTest);

            return viewModel;
		}
コード例 #3
0
        public ActionResult Create()
        {
		    var newItem = new icdtTestModel();
            return View("~/Views/Admin/icdtTests/Create.cshtml", newItem);
        }
コード例 #4
0
		private icdtTest ModelToDomain(icdtTestModel viewModel)
		{
		    icdtTest icdtTest = new icdtTest();
            icdtTest = AutoMapperConfig.Mapper.Map<icdtTestModel, icdtTest>(viewModel);

            return icdtTest;
		}