示例#1
0
 private async Task CreateGoal(LifeGoalsDto input)
 {
     try
     {
         var goal = ObjectMapper.Map <Goals.LifeGoals>(input);
         await _lifeGoalsRepo.InsertAsync(goal);
     }
     catch (UserFriendlyException e)
     {
         throw new UserFriendlyException(e.Message);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
示例#2
0
        private async Task UpdateGoal(LifeGoalsDto input)
        {
            try
            {
                var goal = await _lifeGoalsRepo.FirstOrDefaultAsync((int)input.Id);

                ObjectMapper.Map(input, goal);
            }
            catch (UserFriendlyException e)
            {
                throw new UserFriendlyException(e.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
示例#3
0
 public async Task CreateOrUpdateGoal(LifeGoalsDto input)
 {
     try
     {
         if (input.Id != 0)
         {
             await UpdateGoal(input);
         }
         else
         {
             await CreateGoal(input);
         }
     }
     catch (UserFriendlyException e)
     {
         throw new UserFriendlyException(e.Message);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }