public IActionResult Put([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest());
            }
            var retorno = _bookBusiness.Update(book);

            if (retorno == null)
            {
                return(BadRequest());
            }
            return(new ObjectResult(_bookBusiness.Update(book)));
        }
Example #2
0
        public IActionResult Put([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest());
            }
            var updateBook = _bookBusiness.Update(book);

            if (updateBook == null)
            {
                return(NoContent());
            }
            return(new ObjectResult(updateBook));
        }
        public IActionResult Put(int id, [FromBody] Book book)
        {
            if (book == null)
            {
                return BadRequest();
            }

            var updatedPerson = _bookBusiness.Update(book);
            if (updatedPerson == null)
            {
                return NoContent();
            }

            return new ObjectResult(_bookBusiness.Update(book));
        }
 [TypeFilter(typeof(HyperMediaFilter))] // AnotaĂ§Ă£o para o HATEOAS
 public IActionResult Put([FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(Ok(_bookBusiness.Update(book)));
 }
Example #5
0
 public ActionResult Put(int id, [FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(new ObjectResult(_booksBusiness.Update(book)));
 }
Example #6
0
        public JsonResult Update(Book book)
        {
            if (ModelState.IsValid)
            {
                bookBusiness.Update(book);
            }

            return(Json(book, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public BookResponseViewModel Update(Guid key, BookRequestViewModel book)
        {
            var bookConsult = _bookBusiness.GetByKey(key);
            var bookEntity  = _mapper.Map <Book>(book);

            bookEntity.UniqueKey = key;
            bookEntity.Id        = bookConsult.Id;

            return(_mapper.Map <BookResponseViewModel>(_bookBusiness.Update(bookEntity)));
        }
        public ActionResult Put([FromBody] BookVO book)
        {
            var bookUpdate = new ObjectResult(_bookBusiness.Update(book));

            if (bookUpdate == null)
            {
                return(BadRequest());
            }

            return(bookUpdate);
        }
        // PUT api/values/5
        public IActionResult Put([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest());
            }

            book = _bookBusiness.Update(book);
            if (book.IsNull())
            {
                return(NotFound());
            }
            return(new ObjectResult(book));
        }
Example #10
0
 public ActionResult Put(long id, [FromBody] BookInVO book)
 {
     try
     {
         var _entity = book.CreateEntity();
         _entity.Id = id;
         _bookBusiness.Update(ref _entity);
         var _result = _entity.CreateVO <Book, BookOutVO>();
         return(Ok(_result));
     }
     catch (Exception ex)
     {
         return(this.ReturnActionResult(ex));
     }
 }
Example #11
0
        public IActionResult Put([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest("Check book information"));
            }

            var updatedBook = _bookBusiness.Update(book);

            if (updatedBook == null)
            {
                return(BadRequest("It was not possible to update the data in this book."));
            }
            return(new ObjectResult(updatedBook));
        }
Example #12
0
        public IActionResult Put([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest("Invalid book"));
            }

            var bookOld = _business.FindById(book.Id.Value);

            if (bookOld.Id == null)
            {
                return(NotFound($"Book with id {book.Id} not found"));
            }

            return(new ObjectResult(_business.Update(book)));
        }
Example #13
0
        public IActionResult Put([FromBody] Book book)
        {
            if (book == null)
            {
                return(BadRequest());
            }

            var updatedBook = _bookBusiness.Update(book);

            if (updatedBook == null)
            {
                return(BadRequest());
            }

            return(Ok(updatedBook));
        }
Example #14
0
        public IActionResult Put(long id, [FromBody] BookValue value, [FromServices] IBookBusiness bookBusiness, [FromServices] IMapper mapper)
        {
            value.Id = id;
            var bookDomain = mapper.Map <Book>(value);

            var bookUpdated = bookBusiness.Update(bookDomain);

            if (bookUpdated != null)
            {
                return(Ok(mapper.Map <BookValue>(bookUpdated)));
            }
            else
            {
                return(NotFound());
            }
        }
Example #15
0
        public IActionResult Put([FromBody] BookVO books)
        {
            if (books == null)
            {
                return(BadRequest());
            }

            var result = _bookBusiness.Update(books);

            if (result == null)
            {
                return(BadRequest());
            }

            return(Ok());
        }
        public IActionResult Put([FromBody] Book book)
        {
            if (book == null)
            {
                return(BadRequest());
            }

            var updatedPerson = _bookBusiness.Update(book);

            if (updatedPerson == null)
            {
                return(BadRequest());
            }

            return(new ObjectResult(updatedPerson));
            //return Ok();
        }
 public IActionResult Put(Book book)
 {
     try
     {
         if (book != null)
         {
             return(Ok(_bookBusiness.Update(book)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Example #18
0
        public ActionResult Edit([Bind(Include = "BookId,Title,Description,Text,Visit,CreateDate,ImageName")] Book book
                                 , HttpPostedFileBase imageBook)
        {
            if (ModelState.IsValid)
            {
                if (imageBook != null && imageBook.IsImage())
                {
                    System.IO.File.Delete(Server.MapPath("/Content/Image/Book/" + book.ImageName));
                    System.IO.File.Delete(Server.MapPath("/Content/Image/Book/Thumbnail/" + book.ImageName));

                    book.ImageName = Guid.NewGuid().ToString() + Path.GetExtension(imageBook.FileName);
                    imageBook.SaveAs(Server.MapPath("/Content/Image/Book/" + book.ImageName));
                    ImageResizer img = new ImageResizer();
                    img.Resize(Server.MapPath("/Content/Image/Book/" + book.ImageName),
                               Server.MapPath("/Content/Image/Book/Thumbnail/" + book.ImageName));
                }

                _bookBusiness.Update(book);
                _bookBusiness.Save();
                return(RedirectToAction("Index"));
            }
            return(View(book));
        }
Example #19
0
 public IActionResult Update([FromBody] Book book)
 {
     return(Ok(_business.Update(book)));
 }
Example #20
0
 public void Put(int id, [FromBody] Book value)
 {
     _bus.Update(value);
 }
Example #21
0
 public void Update([FromBody] Book value)
 {
     _bus.Update(value);
 }
Example #22
0
 public IActionResult Put([FromBody] BookVO book)
 {
     return(Ok(_bookBusiness.Update(book)));
 }
Example #23
0
 public void Update([FromBody] BookUpdate bookUpdate) => bookBusiness.Update(bookUpdate);
Example #24
0
 public IActionResult Update([FromBody] Book item)
 {
     if (item == null) return BadRequest();
     return Ok(_bookBusiness.Update(item));
 }
Example #25
0
 /// <summary>
 /// Alterar um livro chamando a camada de business
 /// </summary>
 /// <param name="book">Livro que serĂ¡ alterado</param>
 /// <returns>Livro alterado</returns>
 public BookModel Update(BookModel book)
 {
     return(_bookBusiness.Update(book));
 }
Example #26
0
 public async Task Update([FromBody] Book newBook)
 {
     await business.Update(newBook);
 }