Ejemplo n.º 1
0
        public async Task <IHttpActionResult> AddBook([FromBody] BookRepresentation Book)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var result = await _bookRepository.Add(Book.ToEntity());

            return(Ok(result.ToRepresentation()));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> UpdateBook([FromUri] Guid id, [FromBody] BookRepresentation Book)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            await _bookRepository.Update(id, Book.ToEntity());

            return(Ok());
        }