Beispiel #1
0
        public IActionResult Checkin(string account, string code)
        {
            var user = _sysUserService.getByAccount(account);

            if (user == null)
            {
                return(Json(new { Status = false, Message = "用户不存在" }));
            }
            var order = _orderDetailService.userCurrentOrder(user.Id);

            if (order == null)
            {
                return(Json(new { Status = false, Message = "你当前还没有预定座位" }));
            }

            if (order.VerificationCode.Trim() != code)
            {
                return(Json(new { Status = false, Message = "验证码错误" }));
            }

            order.HasCheckIn = true;
            _orderDetailService.UpdateOrderdetail(order);

            var seat = _librarySeatService.GetById(order.LibrarySeatId);

            seat.SeatState = Entities.LibrarySeat.SeatStates.InAvailable;
            _librarySeatService.UpdateLibrarySeat(seat);

            return(Json(new { Status = false, Message = "打卡成功" }));
        }
        public IActionResult Index()
        {
            if (_adminAuthService.getCurrentUser() == null)
            {
                Redirect(Url.RouteUrl("publicLogin"));
            }
            var user = _adminAuthService.getCurrentUser();

            ViewBag.CurrentOrder = _orderDetailService.userCurrentOrder(user.Id);
            if (ViewBag.CurrentOrder != null)
            {
                OrderDetail orderDetail = ViewBag.CurrentOrder;
                ViewBag.OrderSeat = _librarySeatService.GetById(orderDetail.LibrarySeatId);
            }
            return(View(user));
        }
Beispiel #3
0
 public IActionResult EditLibrarySeat(Guid?id, string returnUrl = null)
 {
     ViewBag.ReturnUrl = Url.IsLocalUrl(returnUrl) ? returnUrl : Url.RouteUrl("librarySeatIndex");
     if (id != null)
     {
         var model = _librarySeatService.GetById(id.Value);
         if (model == null)
         {
             return(Redirect(ViewBag.ReturnUrl));
         }
         return(View(model));
     }
     return(View());
 }