예제 #1
0
파일: Model.cs 프로젝트: anastasiamva/ddd
 public void AddBook(string name, string author, int exemplarsAmount = 1)
 {
     name   = name.Replace('|', ' ');
     author = author.Replace('|', ' ');
     linkedBC.AddBook(name, author, exemplarsAmount);
     OnChangingBookList?.Invoke(null, null);
 }
예제 #2
0
파일: Model.cs 프로젝트: anastasiamva/ddd
 public void ReturnFormular(Formular frm)
 {
     frm.BookLink.RemoveFormular(frm);
     frm.ReaderLink.RemoveFormular(frm);
     linkedFC.RemoveFormular(frm);
     OnChangingBookList?.Invoke(null, null);
     OnChangingTicket?.Invoke(null, null);
 }
예제 #3
0
파일: Model.cs 프로젝트: anastasiamva/ddd
        public void AddFormular(Book b, ReadersTicket rt)
        {
            if (b.FreeExemplarsCount == 0)
            {
                throw new ReturningException("У этой книги больше нет свободных экземпляров.");
            }
            if (rt.Quote == 0)
            {
                throw new ReturningException("У этого читателя закончилась квота, он не может брать больше книг.");
            }
            Formular frm = new Formular(b, rt, DateTime.Now, rt.GiveDays);

            linkedFC.AddFormular(frm);
            b.AddFormular(frm);
            rt.AddFormular(frm);
            OnChangingBookList?.Invoke(null, null);
            OnChangingTicket?.Invoke(null, null);
        }