Пример #1
0
        public async Task <IActionResult> Put([FromBody] WeekUpdateDto week)
        {
            try
            {
                _weekService.Update(week);
                var saveResult = await _weekService.SaveAsync();

                if (saveResult == 0)
                {
                    _logger.LogError($"Unable to update a week at this time id: {week.Id}");
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }

                return(NoContent());
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, $"An error occurred while trying to update a week id: {week.Id}");
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Пример #2
0
 public IActionResult UpdateWeek(Week week)
 {
     weekService.Update(week);
     return(RedirectToAction("Index"));
 }