Ejemplo n.º 1
0
        public IActionResult AddLector(int subjectId, [FromQuery] int semesterId)
        {
            var model = new SubjectAddLectorInputModel
            {
                SemesterId = semesterId,
                SubjectId  = subjectId,
            };

            return(this.View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddLector(int subjectId, [FromQuery] int semesterId, SubjectAddLectorInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            var hasCreated = await this.semestersService.AddLectorAsync(subjectId, semesterId, input.Email);

            if (hasCreated == false)
            {
                this.TempData["message"] = "The test has already closed!";
                return(this.View(input));
            }

            return(this.RedirectToAction("Details", "Semesters", new { semesterId }));
        }