コード例 #1
0
        public ActionResult <string> GetGroup(int id)
        {
            string result = "";

            if (Program.errorStatus == PasswdErrors.PasswdError.NoError)
            {
                result = APIMethods.GetGroup(Program.dataSet.Tables["GroupTable"], id);
            }

            if (Program.errorStatus != PasswdErrors.PasswdError.NoError)
            {
                JObject jObject = PasswdErrors.errorHandler(Program.errorStatus);
                Response.StatusCode = (int)jObject["StatusCode"];

                result = jObject.ToString();
            }
            else if (result == null)
            {
                Response.StatusCode = 404;
                JObject jObject = new JObject();

                jObject.Add("error", $"User with id {id} not found.");
                jObject.Add("error code", Response.StatusCode);

                result = jObject.ToString();
            }
            return(result);
        }