public IActionResult CreateBrand(OrderReq req)
        {
            var result = _svc.CreateOrder(req);

            return(Ok(result));
        }
Example #2
0
        public ActionResult Btn_Yuyue(long?id)
        {
            long userid  = (long)Session["LoginUserId"];
            int  ischeck = checkyuyue((long)id);

            if (ischeck == 1)
            {
                return(Json(new AjaxResult {
                    status = "error", errorMsg = "无法预约自己"
                }));
            }
            if (ischeck == 2)
            {
                return(Json(new AjaxResult {
                    status = "error", errorMsg = "导游未开启预约"
                }));
            }
            if (ischeck == 3)
            {
                return(Json(new AjaxResult {
                    status = "error", errorMsg = "已经预约了"
                }));
            }
            if (ischeck == 4)
            {
                return(Json(new AjaxResult {
                    status = "error", errorMsg = "导游不存在"
                }));
            }
            long oid = OrderSvc.CreateOrder((long)id);

            if (oid != null)
            {
                using (TransactionScope scope = new TransactionScope())//事物
                {
                    var issuccess = OrderUserSvc.appointment(userid, oid);
                    if (issuccess)
                    {
                        bool isadd = LineSvc.AddNumOfPeople((long)id);
                        if (!isadd)
                        {
                            return(Json(new AjaxResult {
                                status = "error", data = "预约失败"
                            }));
                        }
                        scope.Complete();
                        return(Json(new AjaxResult {
                            status = "success", data = "预约成功"
                        }));
                    }
                    else
                    {
                        return(Json(new AjaxResult {
                            status = "error", errorMsg = "预约失败"
                        }));
                    }
                }
            }
            return(Json(new AjaxResult {
                status = "error", errorMsg = ""
            }));
        }
        public IActionResult CreateOrder([FromBody] CreateOrderReq req)
        {
            var res = _svc.CreateOrder(req);

            return(Ok(res));
        }
Example #4
0
        public IActionResult CreateOrder(OrderReq req)
        {
            var result = orderSvc.CreateOrder(req);

            return(Ok(result));
        }