Ejemplo n.º 1
0
        private void Rent()
        {
            bool result = true;

            foreach (var item in ToBeRents)
            {
                item.StartDate = DateTime.Now;
                var rowid = _repo.Add(item);

                item.Book.AvailableCount -= item.Count;
                _repoBook.Update(item.Book);
                SendMsg(new UpdateCountMsg(item.Book));

                result &= rowid > 0;
                if (result)
                {
                    item.Id = rowid;
                    Rents.Insert(0, item);
                }
            }

            if (result)
            {
                Status = string.Format("借出{0}!", result ? "成功" : "失败");
                ToBeRents.Clear();
            }
        }
Ejemplo n.º 2
0
 public void Clear()
 {
     CurrentBook = null;
     ToBeRents.Clear();
     QueryRent();
 }