public override async Task <int> HandleCommand(DeleteCompanyTypeCommand request, CancellationToken cancellationToken)
        {
            CompanyType companyType = null;

            if (request.Model == 0)
            {
                throw new BusinessException("CompanyType.NotSelected");
            }
            else
            {
                companyType = await companyTypeQueries.GetByIdAsync(request.Model);

                if (companyType == null)
                {
                    throw new BusinessException("CompanyType.NotSelected");
                }
            }

            var rs = -1;

            using (var conn = DALHelper.GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        companyType.IsDeleted    = true;
                        companyType.ModifiedDate = DateTime.Now;
                        companyType.ModifiedBy   = request.LoginSession.Id;

                        if (await companyTypeRepository.UpdateAsync(companyType) > 0)
                        {
                            rs = 0;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                    finally
                    {
                        if (rs == 0)
                        {
                            trans.Commit();
                        }
                        else
                        {
                            try { trans.Rollback(); } catch { }
                        }
                    }
                }
            }

            return(rs);
        }
        public async Task <APIResult> GetById(int id)
        {
            var rs = await companytypeQueries.GetByIdAsync(id);

            return(new APIResult()
            {
                Result = 0,
                Data = rs
            });
        }