Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }