Example #1
0
        public bool saveNewLoanentry(NewLoanEntry objNewLoanEntry)
        {
            bool blnValue = true;
            using (var dbContextTransaction = _dbContext.Database.BeginTransaction())
            {
                try
                {
                    _NewLoanEntry.Add(objNewLoanEntry);
                    _dbContext.SaveChanges();

                    objNewLoanEntry.LoanCode = getLoanCode(objNewLoanEntry.Id);

                    _NewLoanEntry.Attach(objNewLoanEntry);
                    var entry = _dbContext.Entry(objNewLoanEntry);
                    entry.Property(e => e.LoanCode).IsModified = true;
                    _dbContext.SaveChanges();

                    dbContextTransaction.Commit();
                }
                catch (Exception)
                {
                    blnValue = false;
                    dbContextTransaction.Rollback();
                }
            }
            return blnValue;
        }
Example #2
0
        public bool updateLoanentry(NewLoanEntry objNewLoanEntry)
        {
            bool blnValue = true;
            using (var dbContextTransaction = _dbContext.Database.BeginTransaction())
            {
                try
                {
                    _NewLoanEntry.Attach(objNewLoanEntry);
                    var entry = _dbContext.Entry(objNewLoanEntry);
                    entry.Property(e => e.LoanAmount).IsModified = true;
                    entry.Property(e => e.LoanPeriod).IsModified = true;
                    entry.Property(e => e.LoanPurpose).IsModified = true;
                    entry.Property(e => e.LoanTypeId).IsModified = true;
                    entry.Property(e => e.ProductTypeId).IsModified = true;
                    entry.Property(e => e.Status).IsModified = true;
                    entry.Property(e => e.LoanPeriod).IsModified = true;
                    entry.Property(e => e.OtherDetails).IsModified = true;
                    entry.Property(e => e.ModifiedBy).IsModified = true;
                    entry.Property(e => e.ModifiedDate).IsModified = true;

                    _dbContext.SaveChanges();

                    dbContextTransaction.Commit();
                }
                catch (Exception)
                {
                    blnValue = false;
                    dbContextTransaction.Rollback();
                }
            }
            return blnValue;
        }
        public void submitLoanStatus(int Id)
        {
            try
            {
                NewLoanEntry objNewLoanEntry = new NewLoanEntry();
                objNewLoanEntry.Id = Id;
                objNewLoanEntry.Status = 1;
                _dbContext.NewLoanEntries.Attach(objNewLoanEntry);
                var entry = _dbContext.Entry(objNewLoanEntry);
                entry.Property(e => e.Status).IsModified = true;
                _dbContext.SaveChanges();
            }
            catch (Exception)
            {

                throw;
            }
        }