public static Account ToEntity(this SaveAccountRequestDTO saveAccountRequestDTO, Account account)
 {
     account.CreatedDate  = DateTime.Now;
     account.ModifiedDate = DateTime.Now;
     account.IsActive     = true;
     account.IsAdmin      = saveAccountRequestDTO.IsAdmin;
     account.Name         = saveAccountRequestDTO.Name;
     account.Email        = saveAccountRequestDTO.Email;
     account.Password     = saveAccountRequestDTO.Password;
     account.Id           = 0;
     return(account);
 }
        public async Task <IActionResult> SaveAccount(SaveAccountRequestDTO saveAccountRequestDTO)
        {
            try
            {
                await _accountService.SaveAccount(saveAccountRequestDTO);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest("An error has occurred on Saving Account!" + ex));
            }
        }
        public async Task SaveAccount(SaveAccountRequestDTO saveAccountRequestDTO)
        {
            Account account = new Account();

            try
            {
                if (saveAccountRequestDTO != null)
                {
                    saveAccountRequestDTO.ToEntity(account);
                    await _unitOfWork.AccountRepository.InsertAccountAsync(account);
                }
                await _unitOfWork.Complete();
            }
            catch (Exception ex)
            {
                _logger.LogExceptionError(ex.ToString());
                throw ex;
            }
        }