コード例 #1
0
ファイル: MyProfileService.cs プロジェクト: e4softwares/SME
        public bool UpdateAgentCustomerDetail(AgentCustomerDetail agentCustomerDetail)
        {
            bool blnValue = true;
            using (var dbContextTransaction = _dbContext.Database.BeginTransaction())
            {
                try
                {
                    _AgentCustomerDetail.Attach(agentCustomerDetail);
                    var entry = _dbContext.Entry(agentCustomerDetail);
                    entry.Property(e => e.CustomerMobileNo).IsModified = true;
                    entry.Property(e => e.CustomerEmailId).IsModified = true;
                    entry.Property(e => e.AgentCustomerName).IsModified = true;
                    entry.Property(e => e.ModifiedDate).IsModified = true;
                    entry.Property(e => e.ModifiedBy).IsModified = true;
                    _dbContext.SaveChanges();
                    dbContextTransaction.Commit();

                }
                catch (Exception)
                {
                    blnValue = false;
                    dbContextTransaction.Rollback();
                }
            }
            return blnValue;
        }
コード例 #2
0
ファイル: MyProfileService.cs プロジェクト: e4softwares/SME
 public bool SaveAgentCustomerDetail(AgentCustomerDetail agentCustomerDetail)
 {
     bool blnValue = true;
     using (var dbContextTransaction = _dbContext.Database.BeginTransaction())
     {
         try
         {
             _AgentCustomerDetail.Add(agentCustomerDetail);
             _dbContext.SaveChanges();
             dbContextTransaction.Commit();
         }
         catch (Exception)
         {
             blnValue = false;
             dbContextTransaction.Rollback();
         }
     }
     return blnValue;
 }