Example #1
0
        void IPiService.ScheduleJob(PiJob job)
        {
            var result = _mathService.GetPi(job.Digits, job.Iterations);

            job.Result  = result.ToString();
            job.EndTime = DateTime.Now;
            job.Status  = "Complete";

            _ctx.PiJobs.Update(job);
            _ctx.SaveChangesAsync();
        }
Example #2
0
        PiJob IPiService.CreateJob(int digits, int iterations)
        {
            var piJob = new PiJob()
            {
                Digits     = digits,
                Iterations = iterations,
                Status     = "Processing",
                StartTime  = DateTime.Now
            };

            _ctx.PiJobs.AddAsync(piJob);
            _ctx.SaveChangesAsync();

            return(piJob);
        }