public async Task Delete_SuccessfulStatusCode_ReturnsOkStatusCode()
        {
            // Arrange
            _booksService.Delete(Arg.Any <string>()).Returns(new OperationResult <Book> {
                Status = Status.Success
            });

            // Act
            var result = await _booksController.Delete("9780132350884") as StatusCodeResult;

            // Assert
            Assert.AreEqual((int)HttpStatusCode.OK, result.StatusCode);
        }
Example #2
0
        public IActionResult Delete(int id)
        {
            var book = _booksService.Get(id);

            _booksService.Delete(book);
            return(NoContent());
        }
        public async Task <ActionResult> Delete([FromRoute] string isbn)
        {
            var response = await _booksService.Delete(isbn);

            if (response.Status == Status.NotFound)
            {
                return(StatusCode((int)HttpStatusCode.NotFound));
            }

            return(StatusCode((int)HttpStatusCode.OK));
        }
        public async Task <ActionResult> Delete(Guid id)
        {
            var bookToDelete = await _booksService.GetOneBookAsync(id);

            if (bookToDelete == null)
            {
                return(NotFound());
            }
            await _booksService.Delete(id);

            return(NoContent());
        }
Example #5
0
        public async Task <ActionResult> DeleteConfirm(DeleteBook model)
        {
            if (ModelState.IsValid)
            {
                // silme islemini yap
                await _booksService.Delete(model.Id);
            }
            // ve

            // liste sayfasina gonder
            return(RedirectToAction("Index", "Books"));
        }
 public IActionResult Delete(int id)
 {
     try
     {
         _booksService.Delete(id);
         return(Ok());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
 public async Task <ActionResult> Delete(Guid id)
 {
     try
     {
         if (id == null)
         {
             ViewBag.Message = "ID can't be empty!";
         }
         else
         {
             await _booksService.Delete(id);
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public IActionResult Delete(int id)
 {
     booksService.Delete(id);
     return(Ok());
 }
Example #9
0
 public void Delete(Guid id)
 {
     service.Delete(id);
 }
Example #10
0
        public async Task <EntityDto> Delete(long id)
        {
            var deletedBook = await _booksService.Delete(id);

            return(deletedBook);
        }
 public IActionResult Delete([FromRoute] string id)
 {
     return(Ok(booksService.Delete(id)));
 }
Example #12
0
 public void DeleteBook(int id)
 {
     _booksService.Delete(id);
 }