示例#1
0
        public async Task <ActionResult> UpdateJob(int key, string values)
        {
            var newValue = await _MyDbContext.Jobs.Include(j => j.Message).FirstOrDefaultAsync(j => j.ID == key);

            JsonConvert.PopulateObject(values, newValue);
            SenderMail a = new SenderMail();

            a.Start(newValue);
            _MyDbContext.Jobs.Update(newValue);
            await _MyDbContext.SaveChangesAsync();

            return(Ok());
        }
示例#2
0
        public async Task <ActionResult> InsertJob(string values)
        {
            var newJob = new MyJob();

            JsonConvert.PopulateObject(values, newJob);
            await _MyDbContext.Jobs.AddAsync(newJob);

            await _MyDbContext.Messages.AddAsync(newJob.Message);

            await _MyDbContext.SaveChangesAsync();

            SenderMail a = new SenderMail();

            a.Start(newJob);
            return(Ok());
        }