Example #1
0
 public void AddClient(string clientName)
 {
     if (!ExistClient(clientName))
     {
         using (BaseContext ctx = new BaseContext())
         {
             Client client = new Client() { Name = clientName };
             ctx.Clients.Add(client);
             ctx.SaveChanges();
         }
     }
 }
Example #2
0
 public Client GetClient(string nameClient)
 {
     using (BaseContext ctx = new BaseContext())
     {
         if (ExistClient(nameClient))
         {
             var temper = ctx.Clients.Where(x => x.Name == nameClient).FirstOrDefault();
             return temper;
         }
         else
         {
             Client client = new Client() { Id = 00, Name = "Клиент не найден" };
             return client;
         }
     }
 }