Ejemplo n.º 1
0
 [HttpPost]                                      // Poderia ser usado um create
 public IActionResult Post([FromBody] Book book) // Esse trecho faz um cast do body recebido para um objeto pessoa
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(Ok(_bookBusiness.Create(book)));
 }
 [HttpPost]                                          // Poderia ser usado um create
 public IActionResult Post([FromBody] Person person) // Esse trecho faz um cast do body recebido para um objeto pessoa
 {
     if (person == null)
     {
         return(BadRequest());
     }
     return(Ok(_personBusiness.Create(person)));
 }
Ejemplo n.º 3
0
        public IActionResult Post([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest("We were unable to insert this book."));
            }
            BookVO books = _bookBusiness.Create(book);

            if (books == null)
            {
                return(BadRequest("We were unable to insert this book."));
            }

            return(Ok(_bookBusiness.Create(book)));
        }
Ejemplo n.º 4
0
        public IActionResult Post([FromBody] BookValue value, [FromServices] IBookBusiness bookBusiness, [FromServices] IMapper mapper)
        {
            var bookDomain = mapper.Map <Book>(value);

            var bookCreated = mapper.Map <BookValue>(bookBusiness.Create(bookDomain));

            return(Created("Post:Book", bookCreated));
        }
 [TypeFilter(typeof(HyperMediaFilter))] // Anotação para o HATEOAS
 public IActionResult Post([FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(Ok(_bookBusiness.Create(book)));
 }
Ejemplo n.º 6
0
 public IActionResult Post([FromBody] Book book)
 {
     if (book == null)
     {
         return BadRequest();
     }
     return new ObjectResult(_bookBusiness.Create(book));
 }
Ejemplo n.º 7
0
 public IActionResult Post([FromBody] BookDTO book)
 {
     if (book == null)
     {
         return(NotFound());
     }
     return(new ObjectResult(_bookBusiness.Create(book)));
 }
Ejemplo n.º 8
0
 public ActionResult Post([FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(new ObjectResult(_booksBusiness.Create(book)));
 }
 public IActionResult Post([FromBody] BookVO book)
 {
     if (book.IsNull())
     {
         return(BadRequest());
     }
     return(new ObjectResult(_bookBusiness.Create(book)));
 }
Ejemplo n.º 10
0
        public JsonResult Create([Bind(Exclude = "BookID")] Book book)
        {
            if (ModelState.IsValid)
            {
                bookBusiness.Create(book);
            }

            return(Json(book, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 11
0
        public IActionResult Post([FromBody] Book book)
        {
            if (book == null)
            {
                return(BadRequest("Deu ruim aqui fera"));
            }

            return(Ok(_bookBusiness.Create(book)));
        }
Ejemplo n.º 12
0
        public IActionResult Post([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest("Invalid book"));
            }

            return(new CreatedResult("", _business.Create(book)));
        }
Ejemplo n.º 13
0
 public ActionResult Post([FromBody] BookInVO book)
 {
     try
     {
         var _entity = book.CreateEntity();
         _bookBusiness.Create(ref _entity);
         var _result = _entity.CreateVO <Book, BookOutVO>();
         return(Accepted(_result));
     }
     catch (Exception ex)
     {
         return(this.ReturnActionResult(ex));
     }
 }
 public IActionResult Post(Book book)
 {
     try
     {
         if (book != null)
         {
             return(Ok(_bookBusiness.Create(book)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Ejemplo n.º 15
0
 public IActionResult Post([FromBody] BookVO books)
 {
     return(new ObjectResult(_converter.Parse(_bookBusiness.Create(books))));
 }
Ejemplo n.º 16
0
 public IActionResult Post([FromBody] Books books)
 {
     return(new ObjectResult(_bookBusiness.Create(books)));
 }
Ejemplo n.º 17
0
 public IActionResult CreateBook([FromBody] Book book)
 {
     return(Ok(_business.Create(book)));
 }
Ejemplo n.º 18
0
 public async Task <Book> Create([FromBody] Book newBook)
 {
     return(await business.Create(newBook));
 }
Ejemplo n.º 19
0
 public IActionResult Post([FromBody] BookVO book)
 {
     return(book == null
         ? (IActionResult)BadRequest()
         : Ok(new ObjectResult(_bookBusiness.Create(book)).Value));
 }
Ejemplo n.º 20
0
 public void Create([FromBody] BookCreate bookCreate) => bookBusiness.Create(bookCreate);
Ejemplo n.º 21
0
 public IActionResult Post([FromBody] BookVO book)
 {
     return(Ok(_bookBusiness.Create(book)));
 }
Ejemplo n.º 22
0
 public IActionResult Create([FromBody] Book item)
 {
     if (item == null) return BadRequest();
     return Ok(_bookBusiness.Create(item));
 }