예제 #1
0
 public bool CreateClient(Client obj)
 {
     try
     {
         using (var ctx = new ZzaDbContext())
         {
             var q = ctx.Clients.Add(obj);
             ctx.SaveChanges();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
예제 #2
0
 public bool UpdateClientInformation(Client obj)
 {
     try
     {
         using (var ctx = new ZzaDbContext())
         {
             var q = ctx.Clients.First(m => m.ID == obj.ID);
             if (q != null)
             {
                 q.HostName = obj.HostName;
                 q.IpAddress = obj.IpAddress;
                 q.Username = obj.Username;
                 q.Password = obj.Password;
                 ctx.SaveChanges();
             }
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }