public async Task <IActionResult> Post([FromBody] InfoRequestDto infoRequestDto)
        {
            if (ModelState.IsValid)
            {
                var item = await _infoRequestService.AddAsync(infoRequestDto);

                return(Ok(item));
            }

            return(NoContent());
        }
        public async Task <InfoRequestDto> GetByIdAsync(string id)
        {
            InfoRequestDto itemDto = null;

            try
            {
                var item = await _infoRequestRepository.FindEntityBy(x => x.Id == id);

                itemDto = _mapper.Map <InfoRequestDto>(item);
            }
            catch (Exception ex)
            {
                LoggerService.LogToFile(ex);
            }

            return(itemDto);
        }
        public async Task <BaseResponse> AddAsync(InfoRequestDto infoRequestDto)
        {
            var response = new BaseResponse();

            try
            {
                var infoRequest = _mapper.Map <InfoRequest>(infoRequestDto);
                if (string.IsNullOrEmpty(infoRequest.Id))
                {
                    infoRequest.Id          = Common.Utilities.Utils.NewGuid;
                    infoRequest.IsActive    = true;
                    infoRequest.RequestDate = DateTime.UtcNow;
                    _infoRequestRepository.Add(infoRequest);

                    var item = await _infoRequestRepository.SaveChanges();

                    var attach = string.Empty;
                    if (!string.IsNullOrEmpty(infoRequestDto.FileName))
                    {
                        var baseDir = _appSettings?.Value?.EbookPath ?? string.Empty;
                        attach = Path.Combine(baseDir, infoRequestDto.FormHdId, infoRequestDto.FileName);
                    }

                    await SendMailToClient(infoRequestDto.Email, infoRequestDto.Name, attach, infoRequestDto.MailTemplateId);

                    response.Success = true;
                    response.Id      = infoRequest.Id;
                    response.Message = LoggingEvents.INSERT_SUCCESS_MESSAGE;
                }
                else
                {
                    response.Message = LoggingEvents.INSERT_FAILED_MESSAGE;
                }
            }
            catch (System.Exception ex)
            {
                response.Message = LoggingEvents.INSERT_FAILED_MESSAGE;
                LoggerService.LogToFile(ex);
            }

            return(response);
        }