コード例 #1
0
        public async Task <double> GetSumOfAmountsAsync(Colleague colleague)
        {
            if (!await IsExistAsync(colleague))
            {
                throw new NotFoundException();
            }

            try
            {
                return(await GetSumOfAmountsAsync(colleague.ColleagueID));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public async Task <bool> DeleteAsync(Colleague colleague)
        {
            if (!(await IsExistAsync(colleague)))
            {
                throw new NotFoundException();
            }

            try
            {
                db.Colleagues.Remove(colleague);
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 public async Task <bool> IsExistAsync(Colleague colleague)
 {
     return(await IsExistAsync(colleague.PhoneNumber) || await IsExistAsync(colleague.ColleagueID));
 }