public HttpResponseMessage Delete([FromUri] string Username)
        {
            IEnumerable <string> values;

            this.Request.Headers.TryGetValues("ApiKey", out values);

            foreach (string v in values)
            {
                if (ud.CheckApi(v))
                {
                    ud.AddUserLogs("User Requested /user/removeuser", v);
                }
            }

            foreach (string v in values)
            {
                if (ud.CheckApiandUserName(v, Username))
                {
                    ud.DeleteUserApi(v);
                    return(Request.CreateErrorResponse(HttpStatusCode.OK, "true"));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.OK, "false"));
                }
            }
            return(Request.CreateErrorResponse(HttpStatusCode.OK, "false"));
        }
Example #2
0
        public HttpResponseMessage Get()
        {
            IEnumerable <string> values;

            this.Request.Headers.TryGetValues("ApiKey", out values);

            foreach (string v in values)
            {
                if (ud.CheckApi(v))
                {
                    ud.AddUserLogs("User Requested /user/removeuser", v);
                }
            }

            foreach (string v in values)
            {
                User user = ud.CheckApiForUser(v);
                return(Request.CreateErrorResponse(HttpStatusCode.OK, "Hello " + user.UserName));
            }
            return(Request.CreateErrorResponse(HttpStatusCode.OK, "Hello"));
        }