Пример #1
0
 public int GetClientId(string email)
 {
     string connectionString = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IClientRepository repository = new ClientRepository(connectionString);
     int clientId = repository.ClientId(email);
     return clientId;
 }
Пример #2
0
 public List<ClientDTO> GetClients()
 {
     string connectionString = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IClientRepository repository = new ClientRepository(connectionString);
     var clients = repository.GetClients();
     var clientsDTO = new List<ClientDTO>();
     foreach (var client in clients)
     {
         clientsDTO.Add(new ClientDTO()
         {
             Id = client.Id,
             FirstName = client.FirstName,
             LastName = client.LastName,
             Email = client.Email,
             Phone = client.Phone
         });
     }
     return clientsDTO;
 }
Пример #3
0
 public void InsertClient(ClientDTO clientDTO)
 {
     var client = new Client
     {
         FirstName = clientDTO.FirstName,
         LastName = clientDTO.LastName,
         Email = clientDTO.Email,
         Phone = clientDTO.Phone
     };
     string connectionString = ConfigurationManager.ConnectionStrings["HotelServiceDB"].ConnectionString;
     IClientRepository repository = new ClientRepository(connectionString);
     repository.Insert(client);
 }