public async Task <IActionResult> AddHtmlOrder([FromBody] HtmlOrder order)
        {
            Debug.WriteLine("Adding new order with frequency= " + order.Frequency + " , orderTarget= " + order.TargetAddress);

            if (!ModelState.IsValid)
            {
                return(BadRequest("Request body is not correct!"));
            }

            using (UnitOfWork unitOfWork = new UnitOfWork(this._databaseContext))
            {
                unitOfWork.HtmlOrderRepository.Add(order);
                await unitOfWork.Save();
            }

            var addingHtmlProvider = new AddingOrderProvider <
                HtmlJobDetailComposer <HtmlOrderJob>,
                SimpleTriggerComposer,
                HtmlOrderJob>(
                new HtmlJobDetailComposer <HtmlOrderJob>(order.Id, order.TargetAddress, order.SubjectOfQuestion),
                new SimpleTriggerComposer(order.Frequency, order.Id));

            await addingHtmlProvider.AddOrder();

            return(new JsonResult(order.Id));
        }
 public static HOrder MapHtmlOrderToHOrder(this HtmlOrder order)
 {
     return(new HOrder(order.Id, order.Frequency, order.TargetAddress, order.SubjectOfQuestion));
 }