コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var deleteBook = await _book.Delete(id);

            if (deleteBook)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            var deleteBook = await _book.Delete(id);

            if (deleteBook)
            {
                Alert("Book deleted successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            Alert("Book not deleted!", NotificationType.error);
            return(View());
        }
コード例 #3
0
        public async Task <IActionResult> Delete(int id)
        {
            var deleteBook = await _book.Delete(id);

            if (deleteBook)
            {
                return(Ok("Book Deleted"));
            }
            else
            {
                return(BadRequest(new { message = "Unable to delete Book details" }));
            }
        }
コード例 #4
0
        public IHttpActionResult Delete(int Id)
        {
            try
            {
                Book _book = _bookRepository.GetBook(Id);
                if (_book == null)
                {
                    return(NotFound());
                }

                _bookRepository.Delete(Id);
                _bookRepository.Save();

                return(Ok("Record Deleted"));
            }
            catch (Exception) { return(BadRequest("Record can not be deleted")); }
        }
コード例 #5
0
 public IActionResult Delete(Guid id)
 {
     try
     {
         if (id == null)
         {
             return(StatusCode(400, $"ID is not valid."));
         }
         else
         {
             _book.Delete(id);
             return(StatusCode(204, "No Content"));
         }
     }
     catch (Exception ex)
     {
         //_logger.LogCritical($"Exception while get list of items.", ex);
         return(StatusCode(500, $"Exception while get list of items. {ex.Message}"));
     }
 }
コード例 #6
0
 // DELETE api/<controller>/5
 public bool Delete(int id)
 {
     return(repositorydb.Delete(id));
 }
コード例 #7
0
 public IActionResult DeleteConfirmed(int id)
 {
     _book.Delete(id);
     _loan.DeleteWithBookId(id);
     return(RedirectToAction(nameof(Index)));
 }