Пример #1
0
        public async Task Add(Role role)
        {
            role.DateOfCreation = DateTime.Now;
            await _sosContext.Role.FirstAsync();

            await _sosContext.Role.AddAsync(role);

            await _sosContext.SaveChangesAsync();
        }
Пример #2
0
        public async Task Add(User user)
        {
            user.DateOfCreation = DateTime.Now;
            await _sosContext.User.FirstAsync();

            await _sosContext.User.AddAsync(user);

            await _sosContext.SaveChangesAsync();
        }
Пример #3
0
        public async Task TrueDelete(Classroom classroom)
        {
            var classroomToDelete = await _sosContext.Classroom.SingleOrDefaultAsync(x => x.Id == classroom.Id);

            if (classroomToDelete != null)
            // Sprawdzić czy sala nie jest używana przez lekcje!!!
            {
                _sosContext.Classroom.Remove(classroomToDelete);
                await _sosContext.SaveChangesAsync();
            }
        }