示例#1
0
        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));
        }
示例#2
0
        public async Task <IActionResult> NewCourse(CourseDto courseDto)
        {
            if (!ModelState.IsValid)
            {
                return(View(await FillCategories(courseDto)));
            }

            await _courseAppService.CreateCourse(courseDto);

            return(RedirectToAction("Index"));
        }
示例#3
0
        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));
            }
        }
示例#4
0
        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
                });
            }
        }
示例#6
0
        public ActionResult AddCourse(CreateCourseInput input)
        {
            var list = _courseAppService.CreateCourse(input);

            return(Content(list.ToJson()));
        }