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

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