Skip to content
Permalink
0b27c5b52b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
44 lines (37 sloc) 1.15 KB
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);
}
}
}