public static UserVIewModel FromDB(UserData context) { var user = new UserVIewModel(); user.Id = context.Id; user.Name = context.Name; user.MIddleName = context.MiddleName; user.LastName = context.LastName; return(user); }
public void FillUsers() { Users = new ObservableCollection <UserVIewModel>(); using (var context = new EntityContext()) { foreach (UserData user in context.UserData) { if (user.IsDeleted == false) { Users.Add(UserVIewModel.FromDB(user)); } } } }