コード例 #1
0
ファイル: PoliceService.cs プロジェクト: dianaMess/Kz2021p1
        public bool CreateCall(PoliceCallHistory policeCallHistory)
        {
            policeCallHistory.DateCall = DateTime.Now;

            int countPolicemen = _policeRepo.GetAll().Count();

            long randomPolicemanId = PolicemanUtils.SearchRandom(countPolicemen);

            policeCallHistory.PolicemanId = randomPolicemanId;

            long userId = _userService.GetUser().Id;

            policeCallHistory.CitizenId = userId;

            _policeCallRepo.Save(policeCallHistory);

            return(true);
        }
コード例 #2
0
ファイル: PolicePresentation.cs プロジェクト: zahavr/Kz2021p1
        public bool CreateCall(PoliceCallHistory policeCallHistory)
        {
            policeCallHistory.DateCall = DateTime.Now;

            List <long> allPolicmanId = _policeRepo.GetAllAsIQueryable()
                                        .Select(p => p.Id)
                                        .ToList();

            long randomPolicemanId = PolicemanUtils.SearchRandom(allPolicmanId);

            policeCallHistory.PolicemanId = randomPolicemanId;

            Citizen citizen = _userService.GetUser();

            policeCallHistory.Citizen = citizen;

            _policeCallRepo.Save(policeCallHistory);

            return(true);
        }