示例#1
0
        public async Task <IActionResult> PutLoanApplication(int id, LoanApplication loanApplication)
        {
            if (id != loanApplication.LoanApplicationId)
            {
                return(BadRequest());
            }

            _context.Entry(loanApplication).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LoanApplicationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutPaymentType(int id, PaymentType paymentType)
        {
            if (id != paymentType.PaymentTypeID)
            {
                return(BadRequest());
            }

            _context.Entry(paymentType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PaymentTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        public async Task <Category> CreateAsync(Category entity)
        {
            var res = await ctx.Categories.AddAsync(entity);

            await ctx.SaveChangesAsync(); // commit transactions

            return(res.Entity);
        }
示例#4
0
        public async Task <Product> CreateAsync(Product entity)
        {
            var res = await ctx.Products.AddAsync(entity);

            await ctx.SaveChangesAsync(); // commit transactions

            return(res.Entity);
        }
        public async Task <ActionResult> ApplyForLoan([FromBody] ApplyLoanViewModel model)
        {
            LoanApplication _loanApplication = new LoanApplication();

            _loanApplication.LoanType     = model.submittedLoanInfo.LoanType;
            _loanApplication.LoanAmount   = model.submittedLoanInfo.LoanAmount;
            _loanApplication.Installments = model.submittedLoanInfo.Installments;

            _loanApplication.UserFirstName        = model.submittedPersonalInfo.FirstName;
            _loanApplication.UserLastName         = model.submittedPersonalInfo.LastName;
            _loanApplication.UserFatherName       = model.submittedPersonalInfo.FathersName;
            _loanApplication.UserMotherName       = model.submittedPersonalInfo.MothersName;
            _loanApplication.UserPresentAddress   = model.submittedPersonalInfo.PresentAddress;
            _loanApplication.UserPermanentAddress = model.submittedPersonalInfo.PermanentAddress;
            _loanApplication.UserCity             = model.submittedPersonalInfo.City;
            _loanApplication.UserState            = model.submittedPersonalInfo.State;
            _loanApplication.UserZipCode          = model.submittedPersonalInfo.ZipCode;
            _loanApplication.UserCountry          = model.submittedPersonalInfo.Country;
            _loanApplication.UserNationality      = model.submittedPersonalInfo.Nationality;
            _loanApplication.UserOccupation       = model.submittedGranterInfo.Occupation;
            _loanApplication.UserDateOfBirth      = model.submittedPersonalInfo.DateOfBirth;
            _loanApplication.UserGender           = model.submittedPersonalInfo.Gender;
            _loanApplication.UserReligion         = model.submittedPersonalInfo.Religion;
            _loanApplication.UserMobile           = model.submittedPersonalInfo.MobileNo;
            _loanApplication.UserEmailAddress     = model.submittedPersonalInfo.Email;
            _loanApplication.UserVerificationType = model.submittedPersonalInfo.VerificationIdType;
            _loanApplication.UserVerificationCode = model.submittedPersonalInfo.VerificationIdNo;

            _loanApplication.GranterFirstName        = model.submittedGranterInfo.FirstName;
            _loanApplication.GranterLastName         = model.submittedGranterInfo.LastName;
            _loanApplication.GranterFatherName       = model.submittedGranterInfo.FathersName;
            _loanApplication.GranterMotherName       = model.submittedGranterInfo.MothersName;
            _loanApplication.GranterPresentAddress   = model.submittedGranterInfo.PresentAddress;
            _loanApplication.GranterPermanentAddress = model.submittedGranterInfo.PermanentAddress;
            _loanApplication.GranterCity             = model.submittedGranterInfo.City;
            _loanApplication.GranterState            = model.submittedGranterInfo.State;
            _loanApplication.GranterZipCode          = model.submittedGranterInfo.ZipCode;
            _loanApplication.GranterCountry          = model.submittedPersonalInfo.Country;
            _loanApplication.GranterNationality      = model.submittedGranterInfo.Nationality;
            _loanApplication.GranterOccupation       = model.submittedGranterInfo.Occupation;
            _loanApplication.GranterDateOfBirth      = model.submittedGranterInfo.DateOfBirth;
            _loanApplication.GranterGender           = model.submittedGranterInfo.Gender;
            _loanApplication.GranterReligion         = model.submittedGranterInfo.Religion;
            _loanApplication.GranterRelation         = model.submittedGranterInfo.Relation;
            _loanApplication.GranterMobile           = model.submittedGranterInfo.MobileNo;
            _loanApplication.GranterEmailAddress     = model.submittedGranterInfo.Email;
            _loanApplication.GranterVerificationType = model.submittedGranterInfo.VerificationIdType;
            _loanApplication.GranterVerificationCode = model.submittedGranterInfo.VerificationIdNo;

            _context.LoanApplications.Add(_loanApplication);
            await _context.SaveChangesAsync();

            return(Ok());
            //return CreatedAtAction("GetLoanApplication", new { id = _loanApplication.LoanApplicationId }, model);
        }
        public async Task <ActionResult <Loan> > GetLoan([FromBody] paymentViewModel model)
        {
            var i = _context.LoanInstallments.Where(x => x.LoanInstallmentId == model.installmentId).First();

            i.ActualPayDate = model.paymentDate;
            i.Penalty       = model.penalty;
            i.Reason        = model.reason;
            i.PayAmount     = i.EMI + model.penalty;
            await _context.SaveChangesAsync();

            return(Ok());
        }
示例#7
0
 public async Task Save()
 {
     await _dataContext.SaveChangesAsync();
 }
示例#8
0
 public async Task <bool> CompleteAsync()
 {
     return(await db.SaveChangesAsync() > 0);
 }