コード例 #1
0
        public DraftMoveObj UpdateLastOnTheClock(OnClockUpdateObj update)
        {
            DraftMoveObj toRet = null;

            lock (_DraftLock)
            {
                bool isPaused = this.GetCurrentDraftStatus().Status == (int)DraftStatusType.Paused;
                if (isPaused)
                {
                    List <DraftMove> onClock = this.GetCurrentOnClock_Internal();

                    if (onClock.Count >= 1)
                    {
                        onClock.Sort(new DraftMoveComparer());
                        DraftMove last        = onClock[onClock.Count - 1];
                        int       secondsLeft = update.SecondsLeft > Settings.SecondsPerPick ? Settings.SecondsPerPick : update.SecondsLeft;
                        last.Time = DateTime.Now - TimeSpan.FromSeconds(Settings.SecondsPerPick - secondsLeft);
                        toRet     = new DraftMoveObj(last);

                        db.SubmitChanges();
                    }
                }
            }

            return(toRet);
        }
コード例 #2
0
        public DraftMoveObj Put(OnClockUpdateObj update)
        {
            DraftUser user = DraftAuthentication.AuthenticateRequest(Request, 1);

            DraftMoveObj toRet = dataSource.UpdateLastOnTheClock(update);

            if (toRet == null)
            {
                throw new HttpStatusException(HttpStatusCode.NotFound, "Unable to find pick to update");
            }

            return(toRet);
        }