public JsonResult MoveInvoiceToNextStatus(string invoiceId, string status) { try { status = status.Replace("Move To", "").Trim(); PaymentGateway pg = new PaymentGateway(); string s = status.Replace(" ", "_"); InvoiceStatus st = (InvoiceStatus)Enum.Parse(typeof(InvoiceStatus), s); pg.SetInvoiceStatus(new Guid(invoiceId), st); if (st == InvoiceStatus.Shipped) { var voice = pg.GetDisplayInvoice(new Guid(invoiceId)); StoreGateway sg = new StoreGateway(); sg.CompileAndSendShippedEmailsForStore(voice); } return Json(new { isSuccess = true, status = st.ToString() }, JsonRequestBehavior.AllowGet); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return Json(new { isSuccess = false }, JsonRequestBehavior.AllowGet); }