Пример #1
0
 public static async Task RemoveSubjectAsync(SubjectData subject)
 {
     using (var db = new UniGuardDbContext())
     {
         db.Attach(subject);
         db.Remove(subject);
         await db.SaveChangesAsync();
     }
 }
Пример #2
0
        public static async Task AddSubjectAsync(string subjectCode, string subjectName,
                                                 string subjectFaculty, int semesterId)
        {
            using (var db = new UniGuardDbContext())
            {
                var subject = new SubjectData {
                    SubjectCode    = subjectCode, SubjectName = subjectName,
                    SubjectFaculty = subjectFaculty, SemesterId = semesterId
                };
                await db.SubjectData.AddAsync(subject);

                await db.SaveChangesAsync();
            }
        }