public ActionResult <IEnumerable <Championship> > AddChampionship(Championship championship)
        {
            try
            {
                return(Ok(_championshipRepository.AddChampionship(championship)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"failed:{ex}");

                return(BadRequest($"failed:{ex}"));
            }
        }
Exemple #2
0
        public ActionResult <IEnumerable <Championship> > AddChampionship([FromBody] Championship championship)
        {
            //i paramatri nome ed anno vengono inviati dal client
            championship.Id         = new Guid();
            championship.IsComplete = false;
            championship.Squadre    = new List <Team>();

            try
            {
                return(Ok(_championshipRepository.AddChampionship(championship)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"failed:{ex}");

                return(BadRequest($"failed:{ex}"));
            }
        }