public JsonResult EditVariableList(string Id, string Name, string Value, string oper) { long ID; decimal Val; bool good = false; if (oper == "del") { if (!Int64.TryParse(Id, out ID)) { return(JSON(false)); } ; good = GeneralRepository.DeleteVariable(ID); if (!good) { Response.StatusCode = 500; } } else { if (oper == "add") { Id = "0"; } if (!Int64.TryParse(Id, out ID)) { return(JSON(false)); } if (!Decimal.TryParse(Value, out Val)) { return(JSON(false)); } good = GeneralRepository.AddEditVariable(ID, Name, Val, oper == "add"); if (!good) { Response.StatusCode = 500; } } return(JSON(true)); }