Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
using System; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
using WebAppCW.Models; | ||
using WebAppCW.Services; | ||
|
||
namespace WebAppCW.ViewModels | ||
{ | ||
public class AccountPageViewModel : ObservableObject | ||
{ | ||
private readonly IDataService _dataService; | ||
|
||
public string Username { get; set; } | ||
public string Password { get; set; } | ||
public string Email { get; set; } | ||
|
||
public ICommand UpdateAccountCommand { get; } | ||
|
||
public ICommand DeleteAccountCommand { get; } | ||
|
||
public AccountPageViewModel(IDataService dataService) | ||
{ | ||
_dataService = dataService; | ||
UpdateAccountCommand = new AsyncRelayCommand(UpdateAccount); | ||
} | ||
|
||
private async Task UpdateAccount() | ||
{ | ||
User updatedUser = new User | ||
{ | ||
Username = Username, | ||
Password = Password, | ||
Email = Email | ||
}; | ||
|
||
await _dataService.UpdateUser(updatedUser); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters