public async Task <double> GetSumOfAmountsAsync(Colleague colleague) { if (!await IsExistAsync(colleague)) { throw new NotFoundException(); } try { return(await GetSumOfAmountsAsync(colleague.ColleagueID)); } catch (Exception) { throw; } }
public async Task <bool> DeleteAsync(Colleague colleague) { if (!(await IsExistAsync(colleague))) { throw new NotFoundException(); } try { db.Colleagues.Remove(colleague); return(true); } catch (Exception) { throw; } }
public async Task <bool> InsertAsync(Colleague colleague) { if (await IsExistAsync(colleague)) { throw new DuplicatePhoneNumberException(); } try { await db.Colleagues.AddAsync(colleague); return(true); } catch (Exception) { throw; } }
public async Task <bool> IsExistAsync(Colleague colleague) { return(await IsExistAsync(colleague.PhoneNumber) || await IsExistAsync(colleague.ColleagueID)); }