public ActionResult Delete(long id) { try { var mt = salesServices.GetById(id); if (mt != null && mt.Status == (byte)VoucherStatus.Pending) { if (mt.Shipments != null) { shipmentServices.DeleteShipment(mt.Shipments.Id); } Logger.Log($"{CurrenUser.FullName} delete sale order with id {mt.VoucherID} bill {mt.VoucherNo}"); salesServices.DeleteOrder(mt); } } catch (Exception ex) { Logger.LogError(ex); } return(RedirectToAction("Index")); }