Esempio n. 1
0
 private void SaveClient()
 {
     if (!string.IsNullOrEmpty(SaveClientViewModel.LastName) ||
         !string.IsNullOrEmpty(SaveClientViewModel.FirstName) ||
         SaveClientViewModel.Birthday != _dateTimeNullValue)
     {
         var client = new Client
         {
             LastName  = SaveClientViewModel.LastName,
             FirstName = SaveClientViewModel.FirstName,
             Birthday  = SaveClientViewModel.Birthday
         };
         var viewModel = new ClientViewModel(client);
         using (var context = new ClientsContext())
         {
             var id = context.CreateClient(client);
             viewModel.Client.Id = id;
         }
         ClientListViewModel.Clients.Add(viewModel);
     }
 }