コード例 #1
0
        /// <summary>
        /// Create new author
        /// </summary>
        /// <param name="name">Name of new author</param>
        /// <param name="sorname">Sorname of new author</param>
        /// <returns>created author</returns>
        public ModelClass.Author AddAuthor(string name, string sorname)
        {
            var newAuthor = new ModelClass.Author()
            {
                ItemId  = GenId(Model.Authors),
                Name    = name,
                Sorname = sorname
            };

            Model.Authors.Add(newAuthor);
            return(newAuthor);
        }
コード例 #2
0
        protected string DisplayAuthor(ModelClass.Author author)
        {
            var s = new StringBuilder();

            s.AppendLine("id: " + author.ItemId.ToString());
            s.AppendLine("Имя: " + author.Name);
            s.AppendLine("Фамилия: " + author.Sorname);
            s.AppendLine("Написанные книги (" + author.BooksWritten.Count.ToString() + "): ");
            foreach (var bookid in author.BooksWritten)
            {
                var book = controller.GetBook(bookid);
                s.AppendLine(book.Year.ToString() + " " + book.Name);
            }
            return(s.ToString());
        }
コード例 #3
0
 protected string DisplayAuthorShort(ModelClass.Author author)
 {
     return(author.Name + " " + author.Sorname);
 }