Example #1
0
        public IActionResult Edit([FromBody] Exam examObject)
        {
            if (examObject == null)
            {
                return(BadRequest());
            }

            try
            {
                _logger.LogInformation("Edit exam in the database.");
                examService.EditExam(examObject);
                _logger.LogInformation($"Exam by ID {examObject.IspitId} has been updated.");
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong: {ex}");
                return(StatusCode(500, "Internal server error."));
            }
        }