/// <summary> /// Add method to add policy /// </summary> /// <param name="entity"></param> /// <returns></returns> public async Task <int> Add(BuyPolicyDTO entity) { try { // call repository method to add policy var test = _mapper.Map <BuyPolicyDTO, BuyPolicy>(entity); return(await _repository.Add(test)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Delete a policy /// </summary> /// <param name="entity"></param> public void Remove(BuyPolicyDTO entity) { try { // call repository method to delete policy var selectedPolicy = _mapper.Map <BuyPolicyDTO, BuyPolicy>(entity); _repository.Remove(selectedPolicy); } catch (Exception ex) { throw ex; } }
public async Task <int> SaveLoanPolicy([FromBody] BuyPolicyDTO policyInfo) { int createdId = 0; try { createdId = await _buyPolicyService.Add(policyInfo); } catch (Exception ex) { using (_logger.BeginScope(new Dictionary <string, object> { { "BuyPolicy", "SaveLoanPolicy" } })) { _logger.LogError(ex.Message); } throw ex; } return(createdId); }