Exemple #1
0
        public void GetByIdTest()
        {
            var group = service.GetAsync(1).Result;

            Assert.IsNotNull(group);
            Assert.AreEqual(group.Id, 1);
        }
 protected override void Resolve(ref Student entity)
 {
     base.Resolve(ref entity);
     entity.Group = entity.GroupId <= 0 ? null : studentGroupService.GetAsync(entity.GroupId).Result;
 }
        protected override void Resolve(ref Lecture entity)
        {
            base.Resolve(ref entity);

            var groupTask = entity.GroupId <= 0 ? Task.FromResult <StudentGroup>(null) : studentGroupService.GetAsync(entity.GroupId);

            var lectorTask = entity.LectorId <= 0 ? Task.FromResult <Employee>(null) : employeeService.GetAsync(entity.LectorId);

            var roomTask = entity.RoomId <= 0 ? Task.FromResult <Room>(null) : roomService.GetAsync(entity.RoomId);

            entity.Group  = groupTask.Result;
            entity.Lector = lectorTask.Result;
            entity.Room   = roomTask.Result;
        }