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()); }
public async Task <IActionResult> Create(QuestionTypeInputModel model) { if (!ModelState.IsValid) { return(View(model)); } await questionTypeService.Add(model); return(RedirectToAction("Index", "Home")); }
public IActionResult Create([FromBody] QuestionType questionType) { if (!ModelState.IsValid) { return(BadRequest()); } _service.Add(questionType); return(Ok(questionType)); }