public async Task <IActionResult> Register([FromBody] WUser wUser) { var newUser = new ApplicationUser { UserName = wUser.Email, Email = wUser.Email, Name = wUser.Name, }; var userCreationResult = await _userManager .CreateAsync(newUser, wUser.Password); if (userCreationResult.Succeeded) { //todo not sure if needed //await _context.ApplicationUsers.AddAsync(newUser); //await _context.SaveChangesAsync(); return(new ObjectResult(GenerateToken(wUser.Email))); //return Ok(newUser); } foreach (var error in userCreationResult.Errors) { ModelState.AddModelError(string.Empty, error.Description); } return(BadRequest(ModelState)); }
private void ButtonClick_AccessEdit(object sender, RoutedEventArgs e) { WUser DataUser = (sender as Button).DataContext as WUser; _UsersEditAccessPage?.ClosePage(); _UsersEditAccessPage = new UsersEditAccessPage(this, DataUser); _UsersEditAccessPage.OpenPage(); }
public UserEditPage(MainMenuWindow _MainMenuWindow, WUser User) { InitializeComponent(); LoadWindowParent(_MainMenuWindow); EventsInitialize(); this.User = User; this.DataContext = this.User; }
private void ButtonClick_UserEdit(object sender, RoutedEventArgs e) { WUser DataUser = (sender as Button).DataContext as WUser; _UserEditPage?.ClosePage(); _UserEditPage = new UserEditPage(_MainMenuWindow, DataUser); _UserEditPage.OpenPage(); _MainMenuWindow.WindowLogic.SetPage(_UserEditPage); }
public static WUser[] ConvertUser(User[] DbUsers) { var Users = new WUser[DbUsers.Length]; for (int i = 0; i < DbUsers.Length; i++) { Users[i] = ConvertUser(DbUsers[i]); } return(Users); }
public IActionResult Put(string id, [FromBody] WUser p) { var recId = new ObjectId(id); var user = objds.GetUser(recId); if (user == null) { return(NotFound()); } objds.Update(recId, p); return(new OkResult()); }
public UsersEditAccessPage(UsersMainPage _UsersMainPage, WUser DataUser) { InitializeComponent(); LoadParentWindows(_UsersMainPage); EventsInitialize(); NetworkEvents(); this.DataUser = DataUser; DataGrid_Access.ItemsSource = AccessCollecton; DataGrid_Access.IsEnabled = false; Sender.SendToServer("Access.GetAll"); }
public async Task <IActionResult> JWTlogin([FromBody] WUser wUser) { var user = await _userManager.FindByEmailAsync(wUser.Email); if (user == null) { ModelState.AddModelError(string.Empty, "Invalid login"); return(BadRequest(ModelState)); } var passwordSignInResult = await _signInManager .CheckPasswordSignInAsync(user, wUser.Password, false); if (passwordSignInResult.Succeeded) { return(new ObjectResult(GenerateToken(wUser.Email))); } return(BadRequest("Invalid login")); }
public static WTeamUserCompilation ConvertTeamUserCompilation(User[] DbUsers, TeamUser[] DbTeamUsers) { var Users = new WUser[DbUsers.Length]; for (int i = 0; i < DbUsers.Length; i++) { Users[i] = ConvertUser(DbUsers[i]); } var TeamUsers = new WTeamUser[DbTeamUsers.Length]; for (int i = 0; i < DbTeamUsers.Length; i++) { TeamUsers[i] = ConvertTeamUser(DbTeamUsers[i]); } return(new WTeamUserCompilation { TeamUsers = TeamUsers, Users = Users }); }
private void ButtonClick_UserDelete(object sender, RoutedEventArgs e) { new ConfirmWindow("Предупреждение", "Вы уверены что хотите удалить элемент?", delegate() { WUser DataUser = (sender as Button).DataContext as WUser; if (Sender.SendToServer("Users.Delete", DataUser.Id)) { DataGrid_Users.IsEnabled = false; ServerResponseDelay = CustomTimer.Create(delegate(object sender, EventArgs e) { ServerResponseDelay = null; new AlertWindow("Ошибка", "Время ожидания ответа от сервера истекло.", () => DataGrid_Users.IsEnabled = true); }, new TimeSpan(0, 0, 5), true); } else { new AlertWindow("Ошибка", AlertWindow.AlertCode.SendToServer); } }); }
public IActionResult Post([FromBody] WUser p) { objds.Create(p); return(new OkObjectResult(p)); }