static async Task Main(string[] args) { var loggerFactory = LoggerFactory.Create(logging => { logging.AddConsole(); logging.SetMinimumLevel(LogLevel.Debug); }); using var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOptions { LoggerFactory = loggerFactory }); //var client = new Student.StudentClient(channel); //StudentReply reply = await client.GetStudentAsync(new StudentIDRequest { StudentID = 1 }); //Console.WriteLine(reply.StudentID); var client = new ApplicantEducation.ApplicantEducationClient(channel); ApplicantEducationReply reply = await client.GetApplicantEducationAsync(new ApplicantEducationIdRequest { Id = "40FAA097-3A8C-E7A0-896C-1255EAC6A6D2" }); ApplicantEducations replies = new ApplicantEducations(); replies.AppEdus.Add(reply); await client.DeleteApplicantEducationAsync(replies); //var reply = await client.GetApplicantEducationsAsync(new Empty()); //Console.WriteLine(reply.CurrentRate.ToDecimal()); }
public override Task <ApplicantEducations> GetApplicantEducations(Empty request, ServerCallContext context) { List <ApplicantEducationPoco> pocos = _logic.GetAll(); ApplicantEducations edus = new ApplicantEducations(); foreach (var poco in pocos) { ApplicantEducationReply reply = FromPoco(poco); edus.AppEdus.Add(reply); } return(Task.FromResult(edus)); }
private ApplicantEducationPoco ToPoco(ApplicantEducationReply reply) { return(new ApplicantEducationPoco() { Id = Guid.Parse(reply.Id), Applicant = Guid.Parse(reply.Applicant), CertificateDiploma = reply.CertificateDiploma, Major = reply.Major, StartDate = reply.StartDate.ToDateTime(), CompletionDate = reply.CompletionDate.ToDateTime(), CompletionPercent = (byte?)reply.CompletionPercent }); }