public AccountDTO Add(AccountDTO x) { var obj = x.toModel(); try { db.Accounts.Add(obj); db.SaveChanges(); } catch { return(null); } return(new AccountDTO(obj)); }
public AccountDTO Update(AccountDTO x) { var a = db.Accounts.Find(x.ID); if (a != null) { try { a = x.toModel(); db.SaveChanges(); } catch { return(null); } return(new AccountDTO(a)); } return(null); }