Implementing of viewModel handling for UI
This commit is contained in:
@ -0,0 +1,81 @@
|
||||
using AdventureWorks.EntityLayer;
|
||||
using Common.Library;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace AdventureWorks.ViewModelLayer;
|
||||
|
||||
public class UserViewModel : ViewModelBase
|
||||
{
|
||||
#region Private Variables
|
||||
private User? _UserObject = new();
|
||||
#endregion
|
||||
|
||||
#region public Properties
|
||||
|
||||
public User? UserObject
|
||||
{
|
||||
get { return _UserObject; }
|
||||
set
|
||||
{
|
||||
_UserObject = value;
|
||||
RaisePropertyChanged(nameof(UserObject));
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get Method
|
||||
public ObservableCollection<User> Get()
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get(id) Method
|
||||
public User? Get(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserObject = new User
|
||||
{
|
||||
UserId = id,
|
||||
LoginId = "SallyJones615",
|
||||
FirstName = "Sally",
|
||||
LastName = "Jones",
|
||||
Email = "sally@jones.com",
|
||||
Password = "password123",
|
||||
Phone = "555-1234",
|
||||
PhoneType = "Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"Error in Get method: {ex.Message}");
|
||||
}
|
||||
|
||||
return UserObject;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Save Method
|
||||
public virtual bool Save()
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user