Ejemplo n.º 1
0
 public IActionResult Delete(int id)
 {
     try
     {
         service.Delete(id);
         return(NoContent());
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await service.Delete(id);

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(NotFound(ex));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Delete(int id)
        {
            var success = await _pilotService.Delete(id);

            if (success)
            {
                return(Ok());
            }

            return(BadRequest());
        }
Ejemplo n.º 4
0
        public IActionResult Delete(int id)
        {
            bool result = service.Delete(id);

            if (!result)
            {
                return(NotFound());
            }

            return(NoContent());
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Delete(int id)
        {
            bool result = await service.Delete(id);

            if (!result)
            {
                return(NotFound());
            }

            return(NoContent());
        }
        public void Delete_WhendeletingItem_ThenElementsInDbBecomeMinusOne()
        {
            // Arrange
            var amountBeforeDeleting = db.Pilots.Count();

            // Act
            service.Delete(testItem.Id);

            // Assert
            Assert.AreEqual(amountBeforeDeleting - 1, db.Pilots.Count());
        }
 public async Task <IActionResult> Delete(int id)
 {
     try
     {
         await service.Delete(id);
     }
     catch (ValidationException e)
     {
         return(BadRequest(new { Exception = e.Message }));
     }
     return(NoContent());
 }
Ejemplo n.º 8
0
        public IActionResult Delete(Guid id)
        {
            try
            {
                pilotService.Delete(id);
            }
            catch (Exception ex)
            {
                return(BadRequest(new { Type = ex.GetType().Name, ex.Message }));
            }

            return(NoContent());
        }
Ejemplo n.º 9
0
 public void Delete(int id)
 {
     _pilotService.Delete(id);
 }
Ejemplo n.º 10
0
        public async Task <IActionResult> Delete(int id)
        {
            await _service.Delete(id);

            return(NoContent());
        }
Ejemplo n.º 11
0
 public void Delete()
 {
     service.Delete();
 }