public void TakeJobOffer(int jobOfferID)
        {
            var jobOffer = jobOfferRepository.GetById(jobOfferID);

            jobOffer.Amount--;

            if (jobOffer.Amount <= 0)
            {
                jobOfferRepository.Remove(jobOfferID);
            }

            jobOfferRepository.SaveChanges();
        }
        public MethodResult CanStartWorkAt(int jobOfferID, Citizen citizen)
        {
            var jobOffer = jobOfferRepository.GetById(jobOfferID);

            if (jobOffer == null)
            {
                return(new MethodResult("Job offer does not exist!"));
            }

            if (citizen == null)
            {
                return(new MethodResult("Only citizens can work!"));
            }

            if (citizen.CompanyEmployee != null)
            {
                return(new MethodResult("You are working in another company!"));
            }

            return(MethodResult.Success);
        }
 public async Task <JobOffer> GetOfferById(string id)
 {
     return(await _jobOfferRepo.GetById(id));
 }