Exemplo n.º 1
0
        public async Task <IActionResult> Create()
        {
            var author = await _author.GetAll();

            var genre = await _genre.GetAll();

            var publisher = await _publisher.GetAll();

            var authorList = author.Select(a => new SelectListItem()
            {
                Value = a.Id.ToString(),
                Text  = a.Title + " " + a.Name
            });

            var genreList = genre.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.Name
            });

            var publisherList = publisher.Select(p => new SelectListItem()
            {
                Value = p.Id.ToString(),
                Text  = p.PublisherName
            });

            ViewBag.author    = authorList;
            ViewBag.genre     = genreList;
            ViewBag.publisher = publisherList;
            return(View());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var model = await _pub.GetAll();

            if (model != null)
            {
                return(View(model));
            }
            return(View());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetAll()
        {
            var users = await _publisher.GetAll();

            return(Ok(users));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> GetAll()
        {
            var pubs = await _pub.GetAll();

            return(Ok(pubs));
        }