Exemplo n.º 1
0
        public async Task <ActionResult <FeeRespObj> > GetAccountTypeByIdAsync([FromQuery] FeeSearchObj search)
        {
            try
            {
                if (search.FeeId < 1)
                {
                    return(new FeeRespObj
                    {
                        Status = new APIResponseStatus {
                            IsSuccessful = false, Message = new APIResponseMessage {
                                FriendlyMessage = "Fee Id is required"
                            }
                        }
                    });
                }

                var response = await _repo.GetFeeByIdAsync(search.FeeId);

                var resplist = new List <credit_fee> {
                    response
                };
                return(new FeeRespObj
                {
                    Fees = _mapper.Map <List <FeeObj> >(resplist),
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new FeeRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
 public static Fee GetFeeById(this IFeeRepository repo, string feeId) => repo.GetFeeByIdAsync(feeId).WrapResult();