public async Task <ActionResult> CancelOrder(string CitizenID) { try { Object data = ""; Init(); SirirajDb db = new SirirajDb(); bool cancelResult = db.CancelOrder(CitizenID); if (cancelResult == false) { throw new Exception("Unable to cancel order"); } else { //Sys Stock To Mem db.InitAvailableItems(); } var success = new { Success = "true" }; return(Json(success, JsonRequestBehavior.AllowGet)); } catch (Exception e) { var resultFail = new { Success = "false", e.Message }; return(Json(resultFail, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> ResetAvailableItems() { try { Object data = ""; Init(); SirirajDb db = new SirirajDb(); db.InitAvailableItems(); var success = new { Success = "true" }; return(Json(success, JsonRequestBehavior.AllowGet)); } catch (Exception e) { var resultFail = new { Success = "false", e.Message }; return(Json(resultFail, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult> DeleteData(string ID, string SecretCode) { Object data = ""; try { Init(); if (SecretCode == AppSettings.SecretCode) { SirirajDb db = new SirirajDb(); data = db.DeleteRegister(ID, SecretCode); db.InitAvailableItems(); } return(Json(data, JsonRequestBehavior.AllowGet)); } catch (Exception e) { var resultFail = new { Success = "false", e.Message }; return(Json(resultFail, JsonRequestBehavior.AllowGet)); } }