public bool UpdateClientPersons(ClientPersons client) { bool res = false; ClientPersons checkClient = db.ClientPersons.SingleOrDefault(x => x.id == client.id); if (checkClient != null) { try { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); res = true; } catch { } } return(res); }
public bool CreateClientPerson(ClientPersons client) { bool res = false; ClientPersons checkCompany = db.ClientPersons.FirstOrDefault(x => x.id == client.id); if (checkCompany == null) { db.ClientPersons.Add(client); try { db.SaveChanges(); res = true; } catch { res = false; } } return(res); }