public long AddViolationForUser(Violations violation) { Citizen user = _userService.GetUser(); violation.PolicemanId = user.Policeman.Id; _violationsRepository.Save(violation); return(violation.Id); }
public long AddViolationForUser(Violations violation) { long?userId = _userService.GetUser()?.Id; long policemanId = _policeRepo.GetAll().SingleOrDefault(p => p.CitizenId == userId).Id; violation.PolicemanId = policemanId; _violationsRepository.Save(violation); return(violation.Id); }