Exemple #1
0
        private void DeleteUser(UserViewModel userViewModel)
        {
            User user = context.Users.Where(u => u.US_Username == userViewModel.UserName).FirstOrDefault();

            if (user == null)
            {
                throw new Exception("User does not exist.");
            }
            context.Users.Remove(user);
            context.SaveChanges();
        }
        public void Insert(ScheduleViewModel svm)
        {
            Schedule schedule = ModelToEntity(svm);

            schedule.SCH_ID               = Guid.NewGuid();
            schedule.SCH_CreationDate     = svm.SCH_CreationDate ?? DateTime.Now;
            schedule.GoverningPolicies    = GetGoverningPoliciesFromVM(svm);
            schedule.GoverningRegulations = GetGoverningRegulationsFromVM(svm);
            schedule.GoverningStatutes    = GetGoverningStatutesFromVM(svm);
            context.Schedules.Add(schedule);
            context.SaveChanges();
        }
        public void InsertAreaScope(AreaScopeViewModel areaScopeVM)
        {
            AreaScope newRecord = new AreaScope {
                AS_Scope = areaScopeVM.Name.Trim()
            };

            context.AreaScopes.Add(newRecord);
            context.SaveChanges();
        }