Beispiel #1
0
        public void CheckedIn(IMediaDetail detail)
        {
            KeyValuePair <IMediaDetail, User> item = CheckedOutItems.Where(i => i.Key.ID == detail.ID).FirstOrDefault();

            detail = item.Key;
            User checkoutUser = item.Value;

            if (CheckedOutItems.TryGetValue(detail, out checkoutUser))
            {
                if (checkoutUser.ID == CurrentUser.ID)
                {
                    CheckedOutItems.Remove(detail);
                }
            }
        }
Beispiel #2
0
        public void CheckOut(IMediaDetail detail)
        {
            CheckInAll();
            var checkInItems = new List <KeyValuePair <IMediaDetail, User> >();

            foreach (KeyValuePair <IMediaDetail, User> item in CheckedOutItems)
            {
                if (item.Value.ID == CurrentUser.ID)
                {
                    checkInItems.Add(item);
                }
            }

            foreach (KeyValuePair <IMediaDetail, User> item in checkInItems)
            {
                CheckedIn(item.Key);
            }

            if (CheckedOutItems != null && detail != null && CurrentUser != null)
            {
                CheckedOutItems.Add(detail, CurrentUser);
            }
        }