public async Task<Account> UpdateAccountAsync(Account account) { if (!_context.Accounts.Local.Any(c => c.Id == account.Id)) { _context.Accounts.Attach(account); } // Form validation if (true) _context.Entry(account).State = EntityState.Modified; await _context.SaveChangesAsync(); return account; }
public async Task<Account> AddAccountAsync(Account account) { // Validate the form here... if (true) { _context.Accounts.Add(account); } else { // implement INotifyDataErrorInfo MessageDialog.PromptError("FormatException Validation Error"); } await _context.SaveChangesAsync(); return account; }