Пример #1
0
        public async Task <GroupModel> GetCreateGroup(IFacultyRepository facultyRepository)
        {
            var faculty = await facultyRepository.AllItems.ToListAsync();

            GroupModel groupModel = new GroupModel();

            groupModel.Faculties = faculty;
            return(groupModel.Clone() as GroupModel);
        }
Пример #2
0
        public async Task <GroupModel> GetEditGroup(IFacultyRepository facultyRepository, int?id)
        {
            if (id == null)
            {
                return(null);
            }

            var group = await AllItems.Include(f => f.Faculty).FirstOrDefaultAsync(z => z.Id == id);

            if (group == null)
            {
                return(null);
            }
            GroupModel model = new GroupModel
            {
                Id        = group.Id,
                Name      = group.Name,
                Faculty   = group.Faculty,
                Faculties = await facultyRepository.ToListAsync()
            };

            return(model.Clone() as GroupModel);
        }