public async Task <Domain.Entity.Account> UpdateAsync(Domain.Entity.Account model) { try { return(await repo.UpdateAsync(model)); } catch (Exception) { throw new Exception("fail"); } }
public async Task <Domain.Entity.Account> AddAsync(Domain.Entity.Account model) { try { await _context.AddAsync(model); await _context.SaveChangesAsync(); return(model); } catch { throw new TimeoutException("Conversion to a DateTime is not supported."); } }
public async Task <Domain.Entity.Account> UpdateAsync(Domain.Entity.Account targetmodel) { try { var model = await _context.Accounts.FirstOrDefaultAsync(m => m.Id == targetmodel.Id); model.Active = targetmodel.Active; model.PassWord = targetmodel.PassWord; model.UserName = targetmodel.UserName; var res = await _context.SaveChangesAsync(); return(model); } catch (Exception) { throw new KeyNotFoundException("Account with this id is not found"); } }