Exemple #1
0
        public IActionResult Post([FromBody] Statistics statistics)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (statistics.Id == 0)
            {
                long id = statisticsRepository.Create(statistics);
                statistics.Id = id;

                return(Ok(statistics));
            }
            else
            {
                statisticsRepository.Update(statistics);

                return(Ok(statistics));
            }
        }