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; } }
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; } }