Beispiel #1
0
        public async Task <Submission> AddSubmission(Submission submission)
        {
            submission.ProfessorUserId = _userAccessor.GetCurrentUserId();

            _gradingDataContext.Submissions.Add(submission);

            var success = await _gradingDataContext.SaveChangesAsync() > 0;

            if (success)
            {
                return(submission);
            }

            throw new Exception("Problem saving changes");
        }
        public async Task <bool> AddCourse(Course course)
        {
            course.ProfessorUserId = _userAccessor.GetCurrentUserId();

            _context.Courses.Add(course);

            var success = await _context.SaveChangesAsync() > 0;

            if (success)
            {
                return(success);
            }

            throw new Exception("Problem saving changes");
        }
Beispiel #3
0
        public async Task AddAssignment(Assignment assignment)
        {
            assignment.ProfessorUserId = _userAccessor.GetCurrentUserId();

            _gradingDataContext.Assignments.Add(assignment);

            var success = await _gradingDataContext.SaveChangesAsync() > 0;

            if (success)
            {
                return;
            }

            throw new Exception("Problem saving changes");
        }
        public async Task <bool> AddSemester(Semester semester)
        {
            _context.Semesters.Add(semester);

            var success = await _context.SaveChangesAsync() > 0;

            if (success)
            {
                return(success);
            }

            throw new Exception("Problem saving changes");
        }