public async Task PrintAll()
        {
            var specialities = await _specialtyService.GetAll();

            var items = (await _groupService.GetAll())
                        .Select(item => new GroupViewModel
            {
                Name          = item.Name,
                SpecialtyName = specialities.First(specialty => specialty.Id == item.SpecialtyId).Name,
            });

            items.WriteCollectionAsTable();
        }
        public async Task <Group> CreateModel()
        {
            return(await Task.Run(async() =>
            {
                Console.WriteLine("Enter group name:");
                var name = Console.ReadLine();
                (await _specialtyService.GetAll()).WriteCollectionAsTable();
                Console.WriteLine("Enter Id of specialty:");
                var specialtyId = int.Parse(Console.ReadLine() ?? throw new InvalidOperationException());

                var group = new Group
                {
                    Name = name,
                    SpecialtyId = specialtyId
                };

                return group;
            }));
        }
Ejemplo n.º 3
0
        public DoctorModel()
        {
            _doctorService    = new DoctorService();
            _chamberService   = new ChamberService();
            _degreeService    = new DegreeService();
            _specialtyService = new SpecialtyService();

            SpecialtyCollection = _specialtyService.GetAll();
            DegreeCollection    = _degreeService.GetAll();
            ChamberCollection   = _chamberService.GetAll();

            GenderCollection = new List <Gender>()
            {
                new Gender()
                {
                    Id = 1, Name = "Male"
                },
                new Gender()
                {
                    Id = 2, Name = "Female"
                }, new Gender()
                {
                    Id = 3, Name = "Others"
                }
            };

            BloodGroupCollection = new List <BloodGroup>()
            {
                new BloodGroup()
                {
                    Id = 1, Name = "A+"
                },
                new BloodGroup()
                {
                    Id = 2, Name = "A-"
                }, new BloodGroup()
                {
                    Id = 3, Name = "AB+"
                }
            };
        }
 public IActionResult GetAll()
 {
     return(Ok(specialtyService.GetAll()));
 }
Ejemplo n.º 5
0
        public async Task PrintAll()
        {
            var items = await _specialtyService.GetAll();

            items.WriteCollectionAsTable();
        }