Esempio n. 1
0
        public IActionResult Put(int id, [FromBody] Period period)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                Period updatedPeriod = periodManager.Update(period);

                return(Created($"periods/{id}", updatedPeriod));
            }
            catch (Exception ex)
            {
                logger.LogError($"Failed to update period {id}: {ex}");
                return(BadRequest(config["Error:Default"]));
            }
        }