Exemple #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            creditcard creditcard = db.creditcards.Find(id);

            db.creditcards.Remove(creditcard);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "card_id,card_num,card_type,card_name,card_expiry,card_cvv")] creditcard creditcard)
 {
     if (ModelState.IsValid)
     {
         db.Entry(creditcard).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(creditcard));
 }
Exemple #3
0
        // GET: creditcards/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            creditcard creditcard = db.creditcards.Find(id);

            if (creditcard == null)
            {
                return(HttpNotFound());
            }
            return(View(creditcard));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "card_id,card_num,card_type,card_name,card_expiry,card_cvv")] creditcard creditcard, string show_id, string total_tickets, string total_price)
        {
            if (ModelState.IsValid)
            {
                db.creditcards.Add(creditcard);
                db.SaveChanges();
                order Order = new order();
                Order.show_id       = Convert.ToInt32(show_id);
                Order.user_id       = Convert.ToInt32(Session["UserId"]);
                Order.total_tickets = Convert.ToInt32(total_tickets);
                Order.total_cost    = Convert.ToInt32(total_price);
                Order.date          = DateTime.Today;
                Random rnd = new Random();

                Order.card_id = rnd.Next(1, 9);
                db.orders.Add(Order);
                db.SaveChanges();
                return(RedirectToAction("Confirmation", "Creditcards"));
            }

            return(View(creditcard));
        }