public ActionResult Create([Bind(Include = "Id,FullName,Mobile,Email,PAN,Aadhar,Company,City")] BusinessPartnerProgramme businessPartnerProgramme) { var isDuplicateAdharOrPan = false; if (db.BusinessPartnerProgrammes.Any(b => b.Aadhar.Equals(businessPartnerProgramme.Aadhar))) { ModelState.AddModelError("Aadhar", "Given Aadhar Number is already registered with us. "); isDuplicateAdharOrPan = true; } if (db.BusinessPartnerProgrammes.Any(b => b.PAN.Equals(businessPartnerProgramme.PAN))) { isDuplicateAdharOrPan = true; ModelState.AddModelError("PAN", "Given PAN Number is already registered with us. "); } if (ModelState.IsValid && !isDuplicateAdharOrPan) { businessPartnerProgramme.CreatedDate = System.DateTime.Now; db.BusinessPartnerProgrammes.Add(businessPartnerProgramme); var x = db.SaveChanges(); TempData["BusinessPartnerSaved"] = "We accepted your details for our Business Partner Programm, our representative will contact you soon."; return(RedirectToAction("Index")); } return(View(businessPartnerProgramme)); }
public ActionResult Create([Bind(Include = "Id,FullName,Mobile,Email,PAN,Aadhar,Company,City,CreatedDate")] BusinessPartnerProgramme businessPartnerProgramme) { if (ModelState.IsValid) { db.BusinessPartnerProgrammes.Add(businessPartnerProgramme); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(businessPartnerProgramme)); }
public ActionResult Create([Bind(Include = "GroupId,GroupName,CityIds")] CityGroup cityGroup) { if (ModelState.IsValid) { db.CityGroups.Add(cityGroup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cityGroup)); }
public ActionResult Create([Bind(Include = "Id,EmployerType,CompanyName,GrossIncomeOrNetSalary,Name,DOB,CityName,MobileNumber,email,CreditCardMaxLimit,OTP,isMobileNumberVerify,isEmailVerify,isUserActive")] UserCCApplyDetail userCCApplyDetail) { if (ModelState.IsValid) { db.UserCCApplyDetail.Add(userCCApplyDetail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userCCApplyDetail)); }
public ActionResult Edit([Bind(Include = "CardId,BankId,CardName,CardDescription,CardImageUrl")] CreditCard creditCard) { if (ModelState.IsValid) { db.Entry(creditCard).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BankId = new SelectList(db.Banks, "BankId", "Name", creditCard.BankId); return(View(creditCard)); }
public ActionResult Create([Bind(Include = "Id,Name,StateId")] City city) { if (ModelState.IsValid) { db.Citys.Add(city); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StateId = new SelectList(db.States, "StateId", "Name", city.StateId); return(View(city)); }
public ActionResult Create([Bind(Include = "Id,EmployerType,CompanyName,GrossIncomeOrNetSalary,Name,DOB,CityName,MobileNumber,email,CreditCardMaxLimit,OTP,isMobileNumberVerify,isEmailVerify,isUserActive,Intended_loan_amount,ApplicationStatusId")] UserLoanApplyDetail userLoanApplyDetail) { if (ModelState.IsValid) { db.UserLoanApplyDetail.Add(userLoanApplyDetail); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApplicationStatus = db.ApplicationStatus.ToList(); ViewData["city"] = db.Citys.ToList(); return(View(userLoanApplyDetail)); }
public ActionResult Create([Bind(Include = "Id,EmployerType,CompanyName,GrossIncomeOrNetSalary,Name,DOB,CityName,MobileNumber,email,CreditCardMaxLimit,OTP,isMobileNumberVerify,isEmailVerify,isUserActive,ApplicationStatusId")] UserCCApplyDetail userCCApplyDetail) { if (ModelState.IsValid) { var start = DateTime.Now; db.UserCCApplyDetail.Add(userCCApplyDetail); db.SaveChanges(); log.DbCallLog("UserCCApplyDetailsController", "CreatePost", (DateTime.Now - start).ToString(), "Time taken to save CC"); return(RedirectToAction("Index")); } ViewBag.ApplicationStatus = db.ApplicationStatus.ToList(); ViewData["city"] = db.Citys.ToList(); return(View(userCCApplyDetail)); }
public ActionResult Create([Bind(Include = "BankId,Name")] Bank bank) { if (ModelState.IsValid) { if (db.Banks.Any(b => b.Name == bank.Name)) { ModelState.AddModelError("Name", "Given Bank Name is already exist in DB. Please try with different name"); } else { db.Banks.Add(bank); db.SaveChanges(); return(RedirectToAction("Index")); } } return(View(bank)); }
public ActionResult Create([Bind(Include = "BankId,Name,LogoUrl")] Bank bank) { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(bank.LogoUrl) || (bank.BankLogoUpload != null && bank.BankLogoUpload.ContentLength > 0)) { if ((bank.BankLogoUpload != null && bank.BankLogoUpload.ContentLength > 0)) { if (!validImageFormets.Contains(bank.BankLogoUpload?.FileName.Split('.').Last())) { ModelState.AddModelError("CardImageUpload", "Upload Card Image in a valid image format, allowed formats are : " + validImageFormets); return(View(bank)); } else { bank.LogoUrl = SaveImageAndGetUrl(bank.BankLogoUpload); } } bank.LogoUrl = SaveImageAndGetUrl(bank.BankLogoUpload); db.Banks.Add(bank); db.SaveChanges(); return(RedirectToAction("Index")); } else { ModelState.AddModelError("BankLogoUpload", "This field is required"); return(View(bank)); } bank.LogoUrl = SaveImageAndGetUrl(bank.BankLogoUpload); db.Banks.Add(bank); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bank)); }
public ActionResult Login([Bind(Include = "LoginName,Password")] User login) { var users = db.UserLogin.ToList(); var user = db.UserLogin.Where(l => l.LoginName == login.LoginName && l.Password == login.Password).FirstOrDefault(); if (user != null) { FormsAuthentication.SetAuthCookie(login.LoginName, false); user.LastLogin = DateTime.Now; db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Dashboard", "Home")); } else { ModelState.AddModelError("Password", "Invalid User Name or Password"); } return(View(login)); }
public int SaveBasic() { #region Save / Update Credit Card CreditCard cc = new CreditCard { CardName = CardName, CardImageUrl = CardImageUrl, CardDescription = CardDescription, CardId = CardId, BankId = BankId }; if (CardId > 0) { db.Entry(cc).State = EntityState.Modified; } else { db.CreditCards.Add(cc); } #endregion Save / Update Credit Card End db.CcDetails.RemoveRange(db.CcDetails.Where(ccd => ccd.CardId == CardId && ccd.CcInfoSectionMasterId == 1).ToList()); ReasonsToGetThisCard.ForEach(r => { var ccdetail = new CcDetail() { Point = r, CcInfoSectionMasterId = 1, Heading = "Top Reasion To Get The Card", CardId = CardId }; db.CcDetails.Add(ccdetail); }); db.SaveChanges(); if (CardId == 0) { CardId = db.CreditCards.Max(ccc => (int)ccc.CardId); } return(CardId); }
// Pass CreditCard Application Id public ActionResult AvilableCreditCardsAsPerApplication() { string id = TempData["ApplyId"] == null ? null : Convert.ToString(TempData["ApplyId"]); var avilableCreditCards = new List <CreditCard> { }; var avilableCardids = new List <int> { }; var avilableCityGroupId = new List <int> { }; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var userCcApplication = db.UserCCApplyDetail.Find(Convert.ToInt32(id)); if (userCcApplication == null) { return(HttpNotFound()); } var cGrp = (from cg in db.CityGroups select new { cg.GroupId, cg.CityIds }).AsEnumerable().Select(item => new KeyValuePair <int, string>(item.GroupId, item.CityIds)).ToList(); foreach (var item in cGrp) { if (item.Value.Split(',').Any(cid => cid.Equals(userCcApplication.CityId.ToString()))) { avilableCityGroupId.Add(item.Key); } } foreach (var cgId in avilableCityGroupId) { var sc = db.CcEligibilityCriterias.ToList(); avilableCardids.AddRange(db.CcEligibilityCriterias.Where(ec => ec.CityGroupId == cgId).Select(ec => ec.CardId).ToList()); var ecs = db.CcEligibilityCriterias.Where(ec => ec.CityGroupId == cgId).ToList(); foreach (var ec in ecs) { if (userCcApplication.EmployerType.Value) { if (userCcApplication.GrossIncomeOrNetSalary.Value >= ec.MinSalary) { userCcApplication.CreditCardId = ec.CardId; db.SaveChanges(); break; } } else { if (userCcApplication.GrossIncomeOrNetSalary.Value >= ec.MinItr) { userCcApplication.CreditCardId = ec.CardId; db.SaveChanges(); break; } } } } avilableCardids = avilableCardids.Distinct().ToList(); foreach (var cardId in avilableCardids) { avilableCreditCards.Add(db.CreditCards.Find(cardId)); } ViewBag.userCcApplication = userCcApplication; return(View(avilableCreditCards)); }