Beispiel #1
0
        public async Task <IActionResult> AddUser([FromBody] PlexUserViewModel user)
        {
            var s = await PlexSettings.GetSettingsAsync();

            var server = s.Servers.FirstOrDefault(x => x.MachineIdentifier == user.MachineIdentifier);
            var result = await PlexApi.AddUser(user.Username, user.MachineIdentifier, server.PlexAuthToken,
                                               user.LibsSelected);

            if (result.HasError)
            {
                return(Json(new
                {
                    Success = false,
                    Error = result.Error.Status
                }));
            }
            else
            {
                return(Json(new
                {
                    Success = true
                }));
            }
        }