public ActionResult GiftSave(DonationUserInfo donationUserInfo)
        {
            var personalInfoes = TempData["PersonalInfo"];

            PersonalInfo personalInfo = (Models.PersonalInfo)TempData["PersonalInfo"];

            db.PersonalInfoes.Add(personalInfo);
            db.SaveChanges();

            // if (ModelState.IsValid)
            {
                for (int i = 0; i < donationUserInfo.DonationIDList.Count; i++)
                {
                    if (donationUserInfo.AmountList[i] != 0)
                    {
                        donationUserInfo.personalInfoID = personalInfo.personalInfoID;
                        donationUserInfo.Amount         = donationUserInfo.AmountList[i];
                        donationUserInfo.DonationID     = donationUserInfo.DonationIDList[i];
                        donationUserInfo.Date           = DateTime.Now;
                        // donationUserInfo.DonationID = Convert.ToInt32(Session["DonationID"]);
                        db.DonationUserInfoes.Add(donationUserInfo);
                        db.SaveChanges();
                    }
                }
                TempData["email"]          = personalInfo.Email;
                TempData["personalInfoID"] = personalInfo.personalInfoID;
                return(RedirectToAction("ModalPopUp", "Confirmation"));
            }

            //return RedirectToAction("Index");
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            DonationUserInfo donationUserInfo = db.DonationUserInfoes.Find(id);

            db.DonationUserInfoes.Remove(donationUserInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "DUID,DonationID,personalInfoID,Date,Amount")] DonationUserInfo donationUserInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(donationUserInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DonationID     = new SelectList(db.DonationDetails, "DonationID", "DonationName", donationUserInfo.DonationID);
     ViewBag.personalInfoID = new SelectList(db.PersonalInfoes, "personalInfoID", "FirstName", donationUserInfo.personalInfoID);
     return(View(donationUserInfo));
 }
Exemple #4
0
        // GET: DonationUserInfoes/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["isAdmin"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else if (Session["isAdmin"].ToString() != "True")
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DonationUserInfo donationUserInfo = db.DonationUserInfoes.Find(id);

            if (donationUserInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(donationUserInfo));
        }
Exemple #5
0
        // GET: DonationUserInfoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["isAdmin"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else if (Session["isAdmin"].ToString() != "True")
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DonationUserInfo donationUserInfo = db.DonationUserInfoes.Find(id);

            if (donationUserInfo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DonationID     = new SelectList(db.DonationDetails, "DonationID", "DonationName", donationUserInfo.DonationID);
            ViewBag.personalInfoID = new SelectList(db.PersonalInfoes, "personalInfoID", "FirstName", donationUserInfo.personalInfoID);
            return(View(donationUserInfo));
        }