예제 #1
0
        public IActionResult UpdateSchedule([FromBody] ScheduleForUpdateDto schedule)
        {
            try
            {
                if (schedule == null)
                {
                    _logger.LogError("Schedule object sent from client is null.");
                    return(BadRequest("Schedule object is null"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.LogError("Invalid Schedule object sent from client.");
                    return(BadRequest("Invalid model object"));
                }

                bool succes = _scheduleLogic.Update(schedule);
                if (!succes)
                {
                    return(NotFound());
                }

                return(Ok("Schedule is updated"));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }