Listviews of Products and users
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
using AdventureWorks.EntityLayer;
|
||||
using AdventureWorks.ViewModelLayer.ViewModelClasses;
|
||||
using Common.Library;
|
||||
|
||||
namespace AdventureWorks.MAUI.CommandClasses
|
||||
{
|
||||
public class ProductViewModelCommands : ProductViewModel
|
||||
{
|
||||
#region Constructors
|
||||
public ProductViewModelCommands() : base()
|
||||
{
|
||||
}
|
||||
public ProductViewModelCommands(IRepository<Product> repo) : base(repo)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
public void LoadProducts()
|
||||
{
|
||||
Get();
|
||||
}
|
||||
public void LoadProductById(int id)
|
||||
{
|
||||
ProductObject = Get(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
53
AdventureWorks.MAUI/CommandClasses/UserViewModelCommands.cs
Normal file
53
AdventureWorks.MAUI/CommandClasses/UserViewModelCommands.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using AdventureWorks.EntityLayer;
|
||||
using AdventureWorks.ViewModelLayer;
|
||||
using Common.Library;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AdventureWorks.MAUI.CommandClasses;
|
||||
|
||||
public class UserViewModelCommands : UserViewModel
|
||||
{
|
||||
#region constructors
|
||||
public UserViewModelCommands() : base()
|
||||
{
|
||||
|
||||
}
|
||||
public UserViewModelCommands(IRepository<User> repo) : base(repo)
|
||||
{
|
||||
}
|
||||
public UserViewModelCommands(IRepository<User> repo, IRepository<PhoneType> phoneRepo) : base(repo, phoneRepo)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
private bool _IsSaveCommandEnabled = true;
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
public bool IsSaveCommandEnabled
|
||||
{
|
||||
get { return _IsSaveCommandEnabled; }
|
||||
set
|
||||
{
|
||||
_IsSaveCommandEnabled = value;
|
||||
RaisePropertyChanged(nameof(IsSaveCommandEnabled));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
public ICommand SaveCommand { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Init Method
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
SaveCommand = new Command(() => Save(), () => IsSaveCommandEnabled);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user