Пример #1
0
 public ActionResult Create([Bind(Include = "Name")] QuestionTypeVM questionTypeVM)
 {
     if (ModelState.IsValid)
     {
         QuestionTypeDTO questionTypeDTO = Mapper.Map <QuestionTypeDTO>(questionTypeVM);
         QuestionTypeService.Add(questionTypeDTO);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Пример #2
0
        public async Task <IActionResult> Create(QuestionTypeInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            await questionTypeService.Add(model);

            return(RedirectToAction("Index", "Home"));
        }
Пример #3
0
        public IActionResult Create([FromBody] QuestionType questionType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            _service.Add(questionType);
            return(Ok(questionType));
        }