Пример #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());
        }