Example #1
0
        public IActionResult ViewSheet(string id)
        {
            var examSheet = ExamSheetManager.GetById(id);
            var model     = CreateClosedSheet(examSheet);

            return(View(model));
        }
        public IActionResult Edit(string id)
        {
            var examSheet = ExamSheetManager.GetById(id);
            var model     = CreateViewModel(examSheet);

            return(View(model));
        }
Example #3
0
        public IActionResult Edit(string id)
        {
            var examSheet = ExamSheetManager.GetById(id);
            var model     = CreateViewModel(examSheet);

            InitSelectItems(model.Faculty.Id);
            return(View(model));
        }
        public IActionResult Edit(TeacherSheetViewModel model, string save, string saveAndClose)
        {
            bool shouldClose = !string.IsNullOrEmpty(saveAndClose);
            var  valid       = ModelState.IsValid && (shouldClose && ExamSheetManager.CloseSheet(model.Id) || !shouldClose);

            if (!valid)
            {
                var examSheet = ExamSheetManager.GetById(model.Id);
                return(View("Edit", CreateViewModel(examSheet)));
            }

            RatingManager.SaveRatings(model.Ratings?.Select(CreateRatingModel));
            return(RedirectToAction("Index"));
        }