コード例 #1
0
        public JsonResult EditStateList(string Id, string Title, string Code, string Country_ID, string oper)
        {
            long ID;
            long country_id;
            bool good = false;

            if (oper == "del")
            {
                if (!Int64.TryParse(Id, out ID))
                {
                    return(JSON(false));
                }
                ;
                good = GeneralRepository.DeleteState(ID);
                if (!good)
                {
                    Response.StatusCode = 500;
                }
            }
            else
            {
                if (oper == "add")
                {
                    Id = "0";
                }
                if (!Int64.TryParse(Id, out ID))
                {
                    return(JSON(false));
                }
                if (!Int64.TryParse(Country_ID, out country_id))
                {
                    return(JSON(false));
                }
                good = GeneralRepository.AddEditState(ID, Title, Code, country_id, oper == "add");
                if (!good)
                {
                    Response.StatusCode = 500;
                }
            }
            return(JSON(true));
        }