コード例 #1
0
 public ActionResult Edit([Bind(Include = "Id,Name")] QuestionTypeVM questionTypeVM)
 {
     if (ModelState.IsValid)
     {
         QuestionTypeDTO questionTypeDTO = Mapper.Map <QuestionTypeDTO>(questionTypeVM);
         QuestionTypeService.Update(questionTypeDTO);
         return(RedirectToAction("Index"));
     }
     return(View(questionTypeVM));
 }
コード例 #2
0
        public IActionResult Update([FromBody] QuestionType questionType, int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            questionType.Id = id;
            _service.Update(questionType);
            return(Ok(questionType));
        }