public static Entity.UserOfClient FromUserOfClientModel(UserOfClientModel context) { using (var database = new Entity.DataBaseModel()) { var user = database.UserOfClient.FirstOrDefault(u => u.Id == context.Id); return(user); } }
public ViewUserOfClientModel() { using (var context = new DataBaseModel()) { context.UserOfClient.Load(); UserOfClients = new ObservableCollection <UserOfClientModel>(); foreach (var item in context.UserOfClient.Local) { UserOfClients.Add(UserOfClientModel.FromUserOfClientModel(item)); } } }