// GET: PosConsumeTk

        public ActionResult Index(long ConsumeId, long itemId = 0)
        {
            if (itemId == 0)
            {
                return(View(new PosConsumeTk()
                {
                    RoomRegId = 0,
                    ConsumeId = ConsumeId,
                    FsTime = DateTime.Now.ToString("yyyy-MM-dd HH:ss")
                }));
            }
            else
            {
                var model = PosConsumeTkBll.SingleOrDefault(itemId);
                if (model == null)
                {
                    model = new PosConsumeTk()
                    {
                        HotelId   = UserContext.CurrentUser.HotelId,
                        RoomRegId = 0,
                        ConsumeId = ConsumeId,
                        FsTime    = DateTime.Now.ToString("yyyy-MM-dd HH:ss")
                    };
                }
                return(View(model));
            }
        }
        public JsonResult AddOrUpdate(PosConsumeTk model)
        {
            var apiResult = new APIResult();
            var user      = UserContext.CurrentUser;

            try
            {
                PosConsumeTkBll.AddOrUpdate(model, user.Id, user.Name, user.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }