private void Create(StudentAssignedOffering studentAssignedOffering, DateTime dateAttended, Subject subject, decimal duration, string notes, EducationSecurityPrincipal user)
        {
            var newAttendance = new ServiceAttendance();

            newAttendance.StudentAssignedOffering = studentAssignedOffering;
            newAttendance.DateAttended            = dateAttended;
            newAttendance.Subject      = subject;
            newAttendance.Duration     = duration;
            newAttendance.Notes        = notes;
            newAttendance.CreatingUser = user.Identity.User;
            ServiceAttendanceRepository.Add(newAttendance);
        }
コード例 #2
0
        public void Create(ServiceAttendanceModel viewModel, EducationSecurityPrincipal user)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            var         studentAssignedOffering = StudentAssignedOfferingRepository.Items.Single(s => s.Id == viewModel.StudentAssignedOfferingId);
            IPermission permission = PermissionFactory.Current.Create("CreateServiceAttendance", studentAssignedOffering);

            permission.GrantAccess(user);
            ServiceAttendance serviceAttendance = new ServiceAttendance
            {
                CreatingUser = user.Identity.User
            };

            viewModel.CopyTo(serviceAttendance);
            ServiceAttendanceRepository.Add(serviceAttendance);
            RepositoryContainer.Save();
        }