public ActionResult Edit([Bind(Include = "GroupId,GroupName,CityIds")] CityGroup cityGroup, FormCollection fc)
 {
     if (ModelState.IsValid)
     {
         var selectedStateId = 0;
         Int32.TryParse(fc["StateId"].ToString(), out selectedStateId);
         var allCitysForGivenState = db.Citys.Where(c => c.StateId == selectedStateId);
         var selectedCityIds       = new StringBuilder();
         if (!string.IsNullOrEmpty(cityGroup.CityIds))
         {
             var oldCityIds = cityGroup.CityIds.Split(',');
             foreach (var cityId in oldCityIds)
             {
                 Int32.TryParse(cityId, out int id);
                 if (!allCitysForGivenState.Any(c => c.Id == id))
                 {
                     selectedCityIds.Append(cityId + ",");
                 }
             }
         }
         cityGroup.CityIds = (selectedCityIds.ToString() + fc["SelectedCityIds"]).Trim(',');
         if (cityGroup.GroupId > 0)
         {
             db.Entry(cityGroup).State = EntityState.Modified;
         }
         else
         {
             db.CityGroups.Add(cityGroup);
         }
         var x = db.SaveChanges();
         return(RedirectToAction("Edit", "CityGroups", new { id = cityGroup.GroupId }));
     }
     return(View(cityGroup));
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,FullName,Mobile,Email,PAN,Aadhar,Company,City,CreatedDate")] BusinessPartnerProgramme businessPartnerProgramme)
 {
     if (ModelState.IsValid)
     {
         db.Entry(businessPartnerProgramme).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(businessPartnerProgramme));
 }
 public ActionResult Edit([Bind(Include = "BankId,Name,LogoUrl")] Bank bank)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bank).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bank));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "Id,EmployerType,CompanyName,GrossIncomeOrNetSalary,Name,DOB,CityName,MobileNumber,email,CreditCardMaxLimit,OTP,isMobileNumberVerify,isEmailVerify,isUserActive")] UserCCApplyDetail userCCApplyDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userCCApplyDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userCCApplyDetail));
 }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "Id,Name,StateId")] City city)
 {
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StateId = new SelectList(db.States, "StateId", "Name", city.StateId);
     return(View(city));
 }
Esempio n. 6
0
 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 Edit([Bind(Include = "Id,EmployerType,CompanyName,GrossIncomeOrNetSalary,Name,DOB,CityId,CreatedDate,CityName,MobileNumber,email,CreditCardMaxLimit,OTP,isMobileNumberVerify,isEmailVerify,isUserActive,ApplicationStatusId")] UserCCApplyDetail userCCApplyDetail)
 {
     if (ModelState.IsValid)
     {
         userCCApplyDetail.CityName        = db.Citys.Find(userCCApplyDetail.CityId).Name;
         db.Entry(userCCApplyDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ApplicationStatus = db.ApplicationStatus.ToList();
     ViewData["city"]          = db.Citys.ToList();
     return(View(userCCApplyDetail));
 }
Esempio n. 8
0
        public int InterestedFor(int CcApplicationId, int Cardid)
        {
            var updateFlag    = 0;
            var ccApplication = db.UserCCApplyDetail.Find(CcApplicationId);

            if (ccApplication != null)
            {
                ccApplication.CreditCardId    = Cardid;
                db.Entry(ccApplication).State = System.Data.Entity.EntityState.Modified;
                updateFlag = db.SaveChanges();
            }
            return(updateFlag);
        }
        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));
        }
Esempio n. 10
0
        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);
        }