public async Task <IActionResult> Register(CourseCreateInput inputCourse) { var coursenew = await _courseAppService.CreateCourse(inputCourse); var output = await _courseAppService.GetCoursesList(); output.Add(coursenew); output.OrderByDescending(t => t.CreationTime); return(View("CourseList", output)); }
public async Task <IActionResult> NewCourse(CourseDto courseDto) { if (!ModelState.IsValid) { return(View(await FillCategories(courseDto))); } await _courseAppService.CreateCourse(courseDto); return(RedirectToAction("Index")); }
public virtual IActionResult CreateCourse(CourseViewModel course) { try { var courseCommand = _courseAppService.CreateCourse(course); return(ReturnResponse(courseCommand, courseCommand, null)); } catch (Exception e) { return(BadRequest("Message: " + e.Message)); } }
public async Task <IActionResult> CreateCourse([FromForm] CreateCourseDto input) { try { var course = await _courseAppService.CreateCourse(input); return(Ok(course)); } catch (Exception e) { Console.WriteLine(e); throw; } }
public async Task <ResponseBase> CreateCourse([FromQuery] string courseCode, string courseContent, string courseName, DateTime dateCreated) { try { GetUserId(); await _courseAppService.CreateCourse(courseCode, courseContent, courseName, UserId, dateCreated); return(new ResponseBase() { IsSuccess = true, ErrorDetails = null }); } catch (Exception ex) { LogError(ex); return(new ResponseBase() { ErrorDetails = Error(), IsSuccess = false }); } }
public ActionResult AddCourse(CreateCourseInput input) { var list = _courseAppService.CreateCourse(input); return(Content(list.ToJson())); }