Beispiel #1
0
        public IActionResult OnGet(int?Id)
        {
            if (Id.HasValue)
            {
                Book   = bookInMemory.GetBook(Id.Value);
                Author = authorInMemory.GetAuthor(Id.Value);

                if (Book == null)
                {
                    return(RedirectToPage("/Books/ListBooks"));
                }
            }
            else
            {
                Book = new Book();
            }
            FullNames = authorInMemory.GetAuthors().Select(x => new SelectListItem
            {
                Value = x.Id.ToString(),
                Text  = x.FullName
            }).ToList();
            return(Page());
        }
Beispiel #2
0
 public void OnGet()
 {
     Authors = authorInMemory.GetAuthors();
 }