예제 #1
0
        public async Task <IActionResult> AddAssignmentSubmit(AddAssignmentModel model)
        {
            if (ModelState.IsValid && model.DueDateTime is DateTime && model.DueDateTime > DateTime.Now)
            {
                var user = await GetCurrentUserAsync();

                if (user is TeacherAccount)
                {
                    var sc         = _schoolClasses.GetByTeacher(user.Id);
                    var assignment = new Assignment()
                    {
                        SchoolClass = sc,
                        DateTime    = DateTime.Now,
                        DueDate     = model.DueDateTime,
                        Name        = model.AssignmentName
                    };

                    _assignments.Add(assignment);

                    return(RedirectToAction("Index"));
                }
            }

            return(RedirectToAction("Error", "Home"));
        }
예제 #2
0
        public IActionResult AddInternshipAssignments([FromBody] AddAssignmentModel model)
        {
            var assignment = new InternshipAssignment
            {
                CompanyId = model.CompanyId,
                Specialization = GetSpecilization(model.Specialization),
                Description = model.Description,
                Environments = EnviromentsToList(model.Enviroments),
                ExtraDescriptionEnvironments = model.ExtraDescr,
                Conditions = model.Conditions,
                ResearchTheme = model.ResearchTheme,
                Location = new Address { Street = model.Street, Number = model.Number, Township = model.Township, PostalNumber = model.Postalnumber},
                AmountOfSupportingEmployees = model.AmountOfSupportingEmployees,
                IntroductionConditions = IndroductionConditionsParseToList(model.IntroductionCondition),
                AmountOfInterns = model.AmountOfInterns,
                SpecificStudentFirstAndLastName = model.SpecificStudentFirstAndLastName,
                OtherComments = model.OtherComments,
                InternshipPeriod = GetInterschipPeriode(model)


            };

            _internshipAssignments.UpdateInternshipAssignment(assignment);
            return Ok();

    }
예제 #3
0
 public InternshipPeriod GetInterschipPeriode(AddAssignmentModel model)
 {
     switch (model.InternshipPeriod)
     {
         case "Semester1":
             return InternshipPeriod.Semester1;
         default:
             return InternshipPeriod.Semester2;
     }
 }
예제 #4
0
        public async Task <IActionResult> AddAssignment(int classId)
        {
            var user = await GetCurrentUserAsync();

            if (user is TeacherAccount teacher)
            {
                var sc = _schoolClasses.GetById(classId);

                var model = new AddAssignmentModel()
                {
                    ForSchoolClass = sc
                };

                return(View(model));
            }

            return(RedirectToAction("Error", "Home"));
        }