예제 #1
0
        public ActionResult Put(string username, string name, [FromBody] Profile value)
        {
            if (!UserService.Exists(username))
            {
                return(BadRequest(new { error = "user by that username was not found." }));
            }

            if (!ProfileService.Exists(username, name))
            {
                return(BadRequest(new { error = "profile not found on user." }));
            }

            ProfileService.UpdateProfileOnUser(username, name, value);
            return(Ok());
        }
예제 #2
0
        public ActionResult Delete(string username, string name)
        {
            if (!UserService.Exists(username))
            {
                return(BadRequest(new { error = "user by that username was not found." }));
            }

            if (!ProfileService.Exists(username, name))
            {
                return(BadRequest(new { error = "profile not found on user." }));
            }

            ProfileService.RemoveProfileFromUser(username, name);
            return(Ok());
        }