Ejemplo n.º 1
0
        public string Put([FromBody] AllowedUserRequest user)
        {
            CSC425Context db     = new CSC425Context();
            var           apikey = Request.Query["api_key"].ToString();

            if (apikey.ToLower() != Security.APIKey)
            {
                return(JsonConvert.SerializeObject(new ReturnCode(401, "Unauthorized", "Bad API Key")));
            }

            return(user.AddUser(db));
        }
Ejemplo n.º 2
0
        public string Delete()
        {
            CSC425Context      db       = new CSC425Context();
            var                apikey   = Request.Query["api_key"].ToString();
            var                NoteID   = Int32.Parse(Request.Query["noteid"].ToString());
            var                Username = Request.Query["username"].ToString();
            AllowedUserRequest user     = new AllowedUserRequest(NoteID, Username);

            if (apikey.ToLower() != Security.APIKey)
            {
                return(JsonConvert.SerializeObject(new ReturnCode(401, "Unauthorized", "Bad API Key")));
            }

            return(user.RemoveUser(db));
        }