示例#1
0
        public async Task <ActionResult <Compte> > DeleteCompte(int id)
        {
            try
            {
                var compteToDelete = await compteRepository.GetCompte(id);

                if (compteToDelete == null)
                {
                    return(NotFound($"Compte with Id = {id} not found"));
                }

                return(await compteRepository.DeleteCompte(id));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error deleting data"));
            }
        }