// Add your own data access methods here.  If you wish to
        // expose your public method to a WCF service, marked them with
        // the attribute [NCPublish], and another T4 template will generate your service contract

        /// <summary>
        /// This method adds or updates new transaction settings
        /// </summary>
        /// <param name="setting">setting</param>
        /// <returns></returns>
        public bool AddOrUpdateTransactionSetting(TransactionSetting setting)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var transactionSettingRepo =
                        new TransactionSettingRepository(new EFRepository <TransactionSetting>(), unitOfWork);

                    ObjectSet <TransactionSetting> transactionSettingObjSet =
                        ((CurrentDeskClientsEntities)transactionSettingRepo.Repository.UnitOfWork.Context).TransactionSettings;

                    //Get present setting from db
                    var dbSetting = transactionSettingObjSet.Where(sett => sett.FK_AdminTransactionTypeID == setting.FK_AdminTransactionTypeID && sett.FK_OrganizationID == setting.FK_OrganizationID).FirstOrDefault();

                    //If settings present in db
                    if (dbSetting != null)
                    {
                        dbSetting.FK_CurrencyID                   = setting.FK_CurrencyID;
                        dbSetting.MinimumDepositAmount            = setting.MinimumDepositAmount;
                        dbSetting.TransferFee                     = setting.TransferFee;
                        dbSetting.InternalTransferApprovalOptions = setting.InternalTransferApprovalOptions;
                        dbSetting.InternalTransferLimitedAmount   = setting.InternalTransferLimitedAmount;
                        dbSetting.MarginRestriction               = setting.MarginRestriction;
                        dbSetting.ConversionMarkupType            = setting.ConversionMarkupType;
                        dbSetting.ConversionMarkupValue           = setting.ConversionMarkupValue;
                    }
                    else
                    {
                        transactionSettingRepo.Add(setting);
                    }

                    //Save and return true
                    transactionSettingRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
 public void Delete(TransactionSetting entity)
 {
     Repository.Delete(entity);
 }
 public void Add(TransactionSetting entity)
 {
     Repository.Add(entity);
 }