Example #1
0
        public override Task <JobArrayMessage> GetJobsByName(SearchParamMessage request, ServerCallContext context)
        {
            JobArrayMessage   jam    = new JobArrayMessage();
            List <Job>        jList  = unitOfWork.JobRepo.Get(j => j.Title.ToLower().Contains(request.Value.ToLower())).ToList();
            List <JobMessage> jmList = new List <JobMessage>();

            foreach (Job j in jList)
            {
                jmList.Add(ConversionStuff.JobToMessage(j));
            }
            jam.Jobs.AddRange(jmList);
            return(Task.FromResult(jam));
        }
Example #2
0
        public override Task <JobArrayMessage> GetAllJobs(Empty request, ServerCallContext context)
        {
            JobArrayMessage   jam    = new JobArrayMessage();
            List <Job>        jList  = unitOfWork.JobRepo.Get(j => true).ToList();
            List <JobMessage> jmList = new List <JobMessage>();

            foreach (Job j in jList)
            {
                jmList.Add(ConversionStuff.JobToMessage(j));
            }
            jam.Jobs.AddRange(jmList);
            return(Task.FromResult(jam));
        }
Example #3
0
        public async Task <JobArrayMessage> GetJobsByName(SearchParamMessage para)
        {
            if (client == null || token == "")
            {
                Debug.WriteLine("Null client or token");
                return(null);
            }

            JobArrayMessage reply = null;

            try
            {
                reply = await client.GetJobsByNameAsync(para, headers);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }

            return(reply);
        }
Example #4
0
        public async Task <JobArrayMessage> GetAllJobs()
        {
            if (client == null || token == "")
            {
                Debug.WriteLine("Null client or token");
                return(null);
            }

            JobArrayMessage reply = null;

            try
            {
                reply = await client.GetAllJobsAsync(new Google.Protobuf.WellKnownTypes.Empty(), headers);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }

            return(reply);
        }