public async Task <IActionResult> Get(int id)
        {
            AuthorDetailsServiceModel model = await this.authorService.GetAuthorDetailsByIdAsync(id);

            if (model == null)
            {
                return(NotFound());
            }

            return(Ok(model));
        }
Esempio n. 2
0
        public async Task <int> Create(string firstName, string lastName)
        {
            var author = new AuthorDetailsServiceModel
            {
                FirstName = firstName,
                LastName  = lastName
            };

            this.db.Add(author);
            await this.db.SaveChangesAsync();

            return(author.Id);
        }