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); } }
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); } }
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); } }