Ejemplo n.º 1
0
        public IActionResult PutSportCountry([FromBody] SportCountry sportCountry)
        {
            try
            {
                if (sportCountry.Equals(null))
                {
                    return(BadRequest("Oops something went wrong."));             // if there was no value entered of sportId it will return a bad request.
                }
                var result = _sportTree.UpdateSportCountry(sportCountry);         // searches the table using the given idea and if the item is found and updated it will return true

                if (result)
                {
                    return(StatusCode(200, StatusCodes.ReturnStatusObject("Successfully Updated")));
                }
                else
                {
                    return(StatusCode(400, StatusCodes.ReturnStatusObject("Update Failed.")));
                }
            }
            catch (Exception e)
            {
                return(StatusCode(400, StatusCodes.ReturnStatusObject("Update Failed.")));
            }
        }