using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using New_College.IServices;
using New_College.Model;
using New_College.Model.ViewModels;

namespace New_College.Api.Controllers.Front
{
    [Route("api/front/[controller]/[action]")]
    [ApiController]
    public class OrderController : ControllerBase
    {
        private readonly IV_OrderInfoServices v_OrderInfoServices;
        public OrderController(IV_OrderInfoServices IV_OrderInfoServices)
        {
            v_OrderInfoServices = IV_OrderInfoServices;
        }

        /// <summary>
        /// 下订单
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<MessageModel<CreateOrderModel>> CreateOrder(UniOrderQuery query)
        {
            var result = await v_OrderInfoServices.CreateOrder(query);
            return new MessageModel<CreateOrderModel>()
            {
                success = result.success,
                msg = result.msg,
                response = result
            };
        }
    }
}
