public bool CitizenToJail(long id) { Citizen citizen = _citizenRepo.Get(id); if (citizen == null) { return(false); } _citizenRepo.Remove(citizen); return(true); }
public Citizen GetUser() { var idStr = _httpContextAccessor .HttpContext.User.Claims.SingleOrDefault(x => x.Type == "Id")?.Value; if (string.IsNullOrEmpty(idStr)) { return(null); } var id = int.Parse(idStr); return(_citizenRepository.Get(id)); }
public IActionResult AddWorker(HCWorkerViewModel newWorker) { var model = _mapper.Map <HCWorker>(newWorker); var citizen = _citizenRepository.Get(newWorker.CitizenId); var facility = _hcestablishmentsRepository.Get(newWorker.FacilityId); model.CitizenId = citizen.Id; model.Name = citizen.Name; model.FacilityId = facility.Id; model.FacilityName = facility.Name; _hcworkerRepository.Save(model); return(RedirectToAction("Index")); }