コード例 #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)));
 }
コード例 #2
0
 [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)));
 }
コード例 #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)));
        }
コード例 #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));
        }
コード例 #5
0
 [TypeFilter(typeof(HyperMediaFilter))] // Anotação para o HATEOAS
 public IActionResult Post([FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(Ok(_bookBusiness.Create(book)));
 }
コード例 #6
0
 public IActionResult Post([FromBody] Book book)
 {
     if (book == null)
     {
         return BadRequest();
     }
     return new ObjectResult(_bookBusiness.Create(book));
 }
コード例 #7
0
 public IActionResult Post([FromBody] BookDTO book)
 {
     if (book == null)
     {
         return(NotFound());
     }
     return(new ObjectResult(_bookBusiness.Create(book)));
 }
コード例 #8
0
 public ActionResult Post([FromBody] BookVO book)
 {
     if (book == null)
     {
         return(BadRequest());
     }
     return(new ObjectResult(_booksBusiness.Create(book)));
 }
コード例 #9
0
 public IActionResult Post([FromBody] BookVO book)
 {
     if (book.IsNull())
     {
         return(BadRequest());
     }
     return(new ObjectResult(_bookBusiness.Create(book)));
 }
コード例 #10
0
        public JsonResult Create([Bind(Exclude = "BookID")] Book book)
        {
            if (ModelState.IsValid)
            {
                bookBusiness.Create(book);
            }

            return(Json(book, JsonRequestBehavior.AllowGet));
        }
コード例 #11
0
        public IActionResult Post([FromBody] Book book)
        {
            if (book == null)
            {
                return(BadRequest("Deu ruim aqui fera"));
            }

            return(Ok(_bookBusiness.Create(book)));
        }
コード例 #12
0
        public IActionResult Post([FromBody] BookVO book)
        {
            if (book == null)
            {
                return(BadRequest("Invalid book"));
            }

            return(new CreatedResult("", _business.Create(book)));
        }
コード例 #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));
     }
 }
コード例 #14
0
 public IActionResult Post(Book book)
 {
     try
     {
         if (book != null)
         {
             return(Ok(_bookBusiness.Create(book)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
コード例 #15
0
 public IActionResult Post([FromBody] BookVO books)
 {
     return(new ObjectResult(_converter.Parse(_bookBusiness.Create(books))));
 }
コード例 #16
0
 public IActionResult Post([FromBody] Books books)
 {
     return(new ObjectResult(_bookBusiness.Create(books)));
 }
コード例 #17
0
 public IActionResult CreateBook([FromBody] Book book)
 {
     return(Ok(_business.Create(book)));
 }
コード例 #18
0
 public async Task <Book> Create([FromBody] Book newBook)
 {
     return(await business.Create(newBook));
 }
コード例 #19
0
 public IActionResult Post([FromBody] BookVO book)
 {
     return(book == null
         ? (IActionResult)BadRequest()
         : Ok(new ObjectResult(_bookBusiness.Create(book)).Value));
 }
コード例 #20
0
 public void Create([FromBody] BookCreate bookCreate) => bookBusiness.Create(bookCreate);
コード例 #21
0
 public IActionResult Post([FromBody] BookVO book)
 {
     return(Ok(_bookBusiness.Create(book)));
 }
コード例 #22
0
 public IActionResult Create([FromBody] Book item)
 {
     if (item == null) return BadRequest();
     return Ok(_bookBusiness.Create(item));
 }