public ActionResult EgitmenBasvuru(InstructorClass ınstructor)
        {
            if (!ModelState.IsValid)
            {
                return(View("EgitmenBasvuru"));
            }
            _instructorService.Insert(ınstructor);

            return(View());
        }
示例#2
0
        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));
        }
示例#3
0
        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));
            }
        }