Ejemplo n.º 1
0
        public IActionResult DeleteSportCountry(int?sportCountry)
        {
            try
            {
                if (!sportCountry.HasValue)
                {
                    return(BadRequest("Oops something went wrong."));     // if there was no value entered of sportId it will return a bad request.
                }
                var result = _sportTree.DeteleSportCountry(sportCountry); //returns a bool based on a row being effected.

                if (result)
                {
                    return(StatusCode(200, StatusCodes.ReturnStatusObject("Delete successful")));
                }
                else
                {
                    return(StatusCode(400, StatusCodes.ReturnStatusObject("Delete Failed.")));
                }
            }
            catch (Exception e)
            {
                return(StatusCode(400, StatusCodes.ReturnStatusObject("The item could not be Deleted. {0}")));
            }
        }