private void AddQuoteSchedule(QuoteSchedule quoteSchedule) { var start = quoteSchedule.StartTime.ToDateTimeOffset().ToLocalTime(); var end = quoteSchedule.EndTime.ToDateTimeOffset().ToLocalTime(); if (DateTimeOffset.Now > end) { return; } start = start.AddMinutes(-10.0); end = end.AddMinutes(5.0); // Schedule the start of the quote. BackgroundJob.Schedule(() => _conn.AddQuote(null), start); // Schedule the end of the quote. BackgroundJob.Schedule(() => _conn.RemoveQuote(quoteSchedule.Quote), end); }
// PUT api/values/5 public void Put(int id, [FromBody] QuoteSchedule QS) { QS.QuoteID = id; _unitwork.QuoteSchedules.Put(QS); _unitwork.Complete(); }
// POST api/values public void Post([FromBody] QuoteSchedule QS) { _unitwork.QuoteSchedules.Post(QS); _unitwork.Complete(); }