Exemple #1
0
 private void MakeUniqueManager(ManagerService managerService, ManagerDTO managerDTO)
 {
     if (managerDTO != null)
     {
         var tmp = managerService.Find(x => x.SecondName == managerDTO.SecondName);
         if (tmp.Count() == 0)
         {
             managerService.MakeManager(managerDTO);
         }
     }
 }
Exemple #2
0
        public void MakeOrder(ClientDTO clientDTO, ItemDTO itemDTO, ManagerDTO managerDTO, int sum)
        {
            ClientService  clientService  = new ClientService(_connectionString);
            ItemService    itemService    = new ItemService(_connectionString);
            ManagerService managerService = new ManagerService(_connectionString);

            MakeUniqueClient(clientService, clientDTO);
            MakeUniqueItem(itemService, itemDTO);
            MakeUniqueManager(managerService, managerDTO);

            clientDTO  = clientService.Find(x => x.Name == clientDTO.Name).First();
            itemDTO    = itemService.Find(x => x.Name == itemDTO.Name).First();
            managerDTO = managerService.Find(x => x.SecondName == managerDTO.SecondName).First();

            Order order = new Order()
            {
                ClientId = clientDTO.Id, ItemId = itemDTO.Id, ManagerId = managerDTO.Id, Sum = sum
            };

            _orderRepository.Create(order);
        }