Exemple #1
0
        public async Task <IActionResult> Create([FromBody] PostBookRequestModel model)
        {
            if (!await _authorsService.ExistsAsync(model.AuthorId))
            {
                return(BadRequest($"Author with id-{model.AuthorId} doesn't exist."));
            }

            return(this.Ok(await _booksService.CreateAsync(model.AuthorId, model.Title, model.Description, model.Price, model.Copies, model.Edition, model.AgeRestriction, model.ReleaseDate, model.Categories)));
        }
Exemple #2
0
        public async Task <IActionResult> Post([FromBody] PostBookRequestModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            return(null);
            //return Ok(await this.Books.Create());
        }