public async Task<ActionResult> Cancel(ViewModelOrderHeader viewModelOrderHeader)
        {
            OrderHeader orderHeader = new OrderHeader();

            Mapper.CreateMap<ViewModelOrderHeader, OrderHeader>();
            orderHeader = Mapper.Map(viewModelOrderHeader, orderHeader);

            if (ModelState.IsValid)
            {
                if (orderHeader.OrderFulfillmentSchedule.CancellationDate == null)
                {
                    orderHeader.OrderFulfillmentSchedule.CancellationDate = DateTime.Now;
                }
                db.Entry(orderHeader.OrderFulfillmentSchedule).State = System.Data.Entity.EntityState.Modified;

                MethodsForOrderHandling.EditOrderHeaderData(orderHeader);
                 
                db.usp_CancelOrder(orderHeader.OrderId);

                await db.SaveChangesAsync();

                MethodsForOrderHandling.SendSmsToAllInvolved(orderHeader.OrderId, "cancel");
                
                return RedirectToAction("Index");

            }           


            return RedirectToAction("Cancel");
        }
        public async Task<ActionResult> Cancel(int? id)
        {
            if (id == null)
            {
                return View("BadRequest");
            }


            var orderHeader = await
                    db.OrderHeaders.Include(o => o.Customer)
                        .Include(o => o.OrderItems)
                        .Include(o => o.Factory)
                        .Include(o => o.OrderFulfillmentSchedule).SingleOrDefaultAsync(o => o.OrderId == id);
            
            if (orderHeader == null)
            {
                return View("NotFound");

            }

            
            ViewModelOrderHeader viewModelOrderHeader = new ViewModelOrderHeader();

            Mapper.CreateMap<OrderHeader, ViewModelOrderHeader>();
            viewModelOrderHeader = Mapper.Map(orderHeader, viewModelOrderHeader);

            ViewBag.PaymentTermId = new SelectList(db.PaymentTerms, "PaymentTermId", "PaymentTermName");

            return View(viewModelOrderHeader);
        }