private IActionResult TryDelete(string name)
        {
            sports.DeleteSport(name);
            OkModelOut okMessage = new OkModelOut()
            {
                OkMessage = "The sport has been deleted successfully"
            };

            return(Ok(okMessage));
        }
Exemple #2
0
        public IActionResult DeleteSport(int id)
        {
            bool deleted = sportService.DeleteSport(id);

            if (deleted)
            {
                return(Ok("El deporte ha sido eliminado"));
            }
            else
            {
                return(BadRequest("No existe el deporte a eliminar"));
            }
        }
        public async Task <ActionResult> DeleteSport(int id)
        {
            try
            {
                await _sportService.DeleteSport(id);

                return(Ok());
            }
            catch (ArgumentNullException exception)
            {
                return(NotFound(exception.Message));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }
Exemple #4
0
 public void DeleteTest()
 {
     GrantAdminPermissions();
     serviceToTest.DeleteSport(testSport.Name);
     sportsStorage.Verify(r => r.Delete(testSport.Name), Times.Once);
 }