示例#1
0
        public bool UpdateAccountHandler(AccountHandlerVM accountHandlerVM)
        {
            using (var dbTransaction = unitOfWork.dbContext.Database.BeginTransaction())
            {
                try
                {
                    tblAccountHandler accountHandler = new tblAccountHandler();
                    accountHandler.CompID             = accountHandler.CompID;
                    accountHandler.AccountHandlerName = accountHandler.AccountHandlerName;
                    accountHandler.Address1           = accountHandler.Address1;
                    accountHandler.Address2           = accountHandler.Address2;
                    accountHandler.Address3           = accountHandler.Address3;
                    accountHandler.ExtraFloat1        = accountHandler.ExtraFloat1;
                    accountHandler.AccountHandlerCode = accountHandler.AccountHandlerCode;
                    accountHandler.AccountHandlerType = accountHandler.AccountHandlerType;
                    accountHandler.AccountHandlerNIC  = accountHandler.AccountHandlerNIC;
                    accountHandler.CreatedDate        = DateTime.Now;
                    accountHandler.CreatedBy          = accountHandler.CreatedBy;
                    accountHandler.AgentBRNo          = accountHandler.AgentBRNo;
                    unitOfWork.TblAccountHandlerRepository.Update(accountHandler);
                    unitOfWork.Save();

                    //Complete the Transaction
                    dbTransaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    //Roll back the Transaction
                    dbTransaction.Rollback();
                    return(false);
                }
            }
        }
示例#2
0
        public bool DeleteAccountHandler(int AccountHandlerID)
        {
            using (var dbTransaction = unitOfWork.dbContext.Database.BeginTransaction())
            {
                try
                {
                    tblAccountHandler accountHandler = unitOfWork.TblAccountHandlerRepository.GetByID(AccountHandlerID);
                    unitOfWork.TblAccountHandlerRepository.Delete(accountHandler);
                    unitOfWork.Save();

                    //Complete the Transaction
                    dbTransaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    //Roll back the Transaction
                    dbTransaction.Rollback();
                    return(false);
                }
            }
        }