Ejemplo n.º 1
0
 public List <Job_ViewModels> GetAllJobsByCompany()
 {
     try{
         string token = Request.Headers.GetValues("Authorization").First();
         int    id    = profilectrl.GetID(token);
         if (id != 0)
         {
             List <Job_ViewModels> list = new List <Job_ViewModels>();
             var c = from a in db.Jobs
                     join b in db.Locations
                     on a.IDLocation equals b.IDLocation
                     where a.IDCompany == id
                     select new { a.IDJob, a.IDCompany, a.IDLocation, b.locationName, a.position, a.jobName, a.postDate, a.expirationDate, a.salary, a.top3Reasons, a.jobContent, a.skillsAndExperience, a.reasonWorking, a.hotJob };
             foreach (var job in c)
             {
                 Job_ViewModels a = new Job_ViewModels(job.IDJob, job.IDLocation, job.IDCompany, job.locationName, job.position, job.jobName, job.postDate, job.expirationDate, job.salary, job.top3Reasons, job.jobContent, job.skillsAndExperience, job.reasonWorking, job.hotJob);
                 list.Add(a);
             }
             return(list);
         }
         return(null);
     }
     catch (Exception e) {
         throw e;
     }
 }
Ejemplo n.º 2
0
        public Job_ViewModels GetAJob(int?id)
        {
            Job jobf = db.Jobs.Where(j => j.IDJob == id).SingleOrDefault();

            if (jobf == null)
            {
                return(null);
            }
            Job_ViewModels job = new Job_ViewModels(jobf.IDJob, jobf.IDLocation, jobf.IDCompany, locationctrl.GetLocation(jobf.IDLocation).locationName, jobf.position, jobf.jobName, jobf.postDate, jobf.expirationDate, jobf.salary, jobf.top3Reasons, jobf.jobContent, jobf.skillsAndExperience, jobf.reasonWorking, jobf.hotJob);

            return(job);
        }