public Task <bool> UpdateAsync(TPAY_TYPESVM entity)
 {
     return(Task.Run <bool>(() =>
     {
         TPAY_TYPES tPay = new TPAY_TYPES
         {
             PAY_TYPE_ID = entity.PAY_TYPE_ID,
             AddedBy = entity.AddedBy,
             AddedOn = entity.AddedOn,
             Disable = entity.Disable,
             PAY_TYPE_AR_NAME = entity.PAY_TYPE_AR_NAME,
             PAY_TYPE_CODE = entity.PAY_TYPE_CODE,
             PAY_TYPE_EN_NAME = entity.PAY_TYPE_EN_NAME,
             PAY_TYPE_NOTES = entity.PAY_TYPE_NOTES,
             UpdatedBy = entity.UpdatedBy,
             UpdatedOn = entity.UpdatedOn,
             AccountID = entity.AccountID,
             MaxCommission = entity.MaxCommission,
             BankCommissionRate = entity.BankCommissionRate,
             CommissionTaxRate = entity.CommissionTaxRate,
         };
         _TPAY_TYPESRepo.Update(tPay, tPay.PAY_TYPE_ID);
         return true;
     }));
 }
        public async Task <IHttpActionResult> update([FromBody] TPAY_TYPESVM entity)
        {
            var result = await tPayTypesService.UpdateAsync(entity);

            await LogData(entity.PAY_TYPE_CODE, entity.PAY_TYPE_ID.ToString());

            return(Ok(result));
        }
        public bool Delete(TPAY_TYPESVM entity)
        {
            TPAY_TYPES tPay = new TPAY_TYPES
            {
                PAY_TYPE_ID = entity.PAY_TYPE_ID
            };

            _TPAY_TYPESRepo.Delete(tPay, entity.PAY_TYPE_ID);
            return(true);
        }
        public async Task <IHttpActionResult> add([FromBody] TPAY_TYPESVM entity)
        {
            var result = await tPayTypesService.InsertAsync(entity);

            await LogData(entity.PAY_TYPE_CODE, result.ToString());

            if (result != 0)
            {
                return(Ok(true));
            }
            return(Ok(false));
        }
        public Task <bool> DeleteAsync(TPAY_TYPESVM entity)
        {
            return(Task.Run <bool>(() =>
            {
                TPAY_TYPES tPay = new TPAY_TYPES
                {
                    PAY_TYPE_ID = entity.PAY_TYPE_ID
                };

                _TPAY_TYPESRepo.Delete(tPay, entity.PAY_TYPE_ID);
                return true;
            }));
        }
        public async Task <IHttpActionResult> delete([FromBody] TPAY_TYPESVM entity)
        {
            var q = billMasterService.getByPayTypeId(entity.PAY_TYPE_ID.ToString());

            if (q.Count == 0)
            {
                var result = await tPayTypesService.DeleteAsync(entity);
                await LogData(entity.PAY_TYPE_CODE, entity.PAY_TYPE_ID.ToString());

                return(Ok(result));
            }
            else
            {
                return(Ok(false));
            }
            //return Ok(await tPayTypesService.DeleteAsync(entity));
        }
        public bool Update(TPAY_TYPESVM entity)
        {
            TPAY_TYPES tPay = new TPAY_TYPES
            {
                PAY_TYPE_ID        = entity.PAY_TYPE_ID,
                AddedBy            = entity.AddedBy,
                AddedOn            = entity.AddedOn,
                Disable            = entity.Disable,
                PAY_TYPE_AR_NAME   = entity.PAY_TYPE_AR_NAME,
                PAY_TYPE_CODE      = entity.PAY_TYPE_CODE,
                PAY_TYPE_EN_NAME   = entity.PAY_TYPE_EN_NAME,
                PAY_TYPE_NOTES     = entity.PAY_TYPE_NOTES,
                UpdatedBy          = entity.UpdatedBy,
                UpdatedOn          = entity.UpdatedOn,
                AccountID          = entity.AccountID,
                MaxCommission      = entity.MaxCommission,
                BankCommissionRate = entity.BankCommissionRate,
                CommissionTaxRate  = entity.CommissionTaxRate,
            };

            _TPAY_TYPESRepo.Update(tPay, tPay.PAY_TYPE_ID);
            return(true);
        }