public ActionResult EgitmenBasvuru(InstructorClass ınstructor) { if (!ModelState.IsValid) { return(View("EgitmenBasvuru")); } _instructorService.Insert(ınstructor); return(View()); }
public async Task <IActionResult> Create(InstructorDTO instructorDTO) { if (ModelState.IsValid) { var instructor = _mapper.Map <Instructor>(instructorDTO); instructor = await _instructorService.Insert(instructor); var id = instructor.ID; return(RedirectToAction("Index")); } return(View(instructorDTO)); }
public async Task <IActionResult> Create(InstructorDTO instructorDTO) { try { if (ModelState.IsValid) { var instructor = _mapper.Map <Instructor>(instructorDTO); var data = await _instructorService.Insert(instructor); return(RedirectToAction(nameof(Index))); } return(View(instructorDTO)); } catch (Exception ex) { ViewBag.Message = ex.Message; ViewBag.Type = "danger"; return(View(instructorDTO)); } }