Ejemplo n.º 1
0
        public void TakeJobOffer(int jobOfferID)
        {
            var jobOffer = jobOfferRepository.GetById(jobOfferID);

            jobOffer.Amount--;

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

            jobOfferRepository.SaveChanges();
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public async Task <JobOffer> GetOfferById(string id)
 {
     return(await _jobOfferRepo.GetById(id));
 }