Esempio n. 1
0
        public async Task <CourseOrder> CreateOrder(Guid courseId)
        {
            var memberId = User.Claims.First(x => x.Type == "sub").Value;
            var course   = await exploreService.GetCourseAsync(courseId);

            var orderId    = Guid.NewGuid();
            var orderModel = new CourseOrder
            {
                Id         = orderId,
                CourseId   = courseId,
                CreateTime = DateTime.Now,
                MemberId   = memberId,
                Fee        = (course.Price * 100).ToString(),
                Name       = "Order - " + course.Name,
                Status     = OrderStatus.Create,
                Price      = course.Price,
                Desc       = course.Description,
                OrderType  = OrderType.Course,
                PayChannel = PayChannel.WeChatNative
            };
            await courseOrderService.CreateOrder(orderModel);

            return(orderModel);
        }
Esempio n. 2
0
        public async Task OnPost(TaskCourseInput courseInput)
        {
            var memberId = User.Claims.First(x => x.Type == "sub").Value;
            var course   = await exploreService.GetCourseAsync(courseInput.CourseId);

            var orderId = Guid.NewGuid();
            await couseOrderService.CreateOrder(new CourseOrder
            {
                Id         = orderId,
                CourseId   = courseInput.CourseId,
                CreateTime = DateTime.Now,
                MemberId   = memberId,
                Fee        = (course.Price * 100).ToString(),
                Name       = "Order - " + course.Name,
                Status     = OrderStatus.Create,
                Price      = course.Price,
                Desc       = course.Description,
                OrderType  = OrderType.Course,
                PayChannel = PayChannel.WeChatNative
            });

            Redirect("/Pay/WxNativePay/" + orderId);
        }