Example #1
0
        public ActionResult Edit([Bind(Include = "user_id, username, email, login_failures, first_name, last_name, phone, gender, birthdate, date_joined, is_employee, is_admin, is_member, is_inactive, is_locked_out, is_on_email_list, favorite_platform, favorite_category, notes")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
                {
                    Exception raise = dbEx;
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            string message = string.Format("{0}:{1}",
                                                           validationErrors.Entry.Entity.ToString(),
                                                           validationError.ErrorMessage);
                            // raise a new exception nesting
                            // the current instance as InnerException
                            raise = new InvalidOperationException(message, raise);
                        }
                    }
                    throw raise;
                }
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("MyIndex", new { uname = this.User.Identity.Name }));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "user_id,username,email,user_password,login_failures,first_name,last_name,phone,gender,birthdate,date_joined,is_employee,is_admin,is_member,is_inactive,is_locked_out,is_on_email_list,favorite_platform,favorite_category,notes")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(user);
 }
 public ActionResult Edit([Bind(Include = "user_game_id,user_id,game_id,date_purchased,rating")] User_Game user_Game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user_Game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user_Game));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "genre_id,genre_name,description")] Genre genre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(genre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(genre));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "province_id,province_code,province_name")] Province province)
 {
     if (ModelState.IsValid)
     {
         db.Entry(province).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(province));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "publisher_id,publisher_name,contact_name,contact_phone,contact_email")] Publisher publisher)
 {
     if (ModelState.IsValid)
     {
         db.Entry(publisher).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(publisher));
 }
 public ActionResult Edit([Bind(Include = "game_name,Units_Sold,Profit_Margin,Sales_Volume,Total_Profit")] Sales_Report sales_Report)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sales_Report).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sales_Report));
 }
Example #8
0
 public ActionResult Edit([Bind(Include = "address_id,street_address,city,province_id,postal_code")] Address address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.province_id = new SelectList(db.Provinces, "province_id", "province_code", address.province_id);
     return(View(address));
 }
Example #9
0
 public ActionResult Edit([Bind(Include = "store_event_id,store_event_name,description,address_id,start_date,end_date,max_registrants,is_full,is_members_only,is_cancelled")] Store_Event store_Event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store_Event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.address_id = new SelectList(db.Addresses, "address_id", "street_address", store_Event.address_id);
     return(View(store_Event));
 }
Example #10
0
        public ActionResult Edit([Bind(Include = "review_id,user_id,game_id,review_date,review_content,is_approved,is_deleted")] Review review)
        {
            if (ModelState.IsValid)
            {
                db.Entry(review).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(review));
        }
Example #11
0
 public ActionResult Edit([Bind(Include = "credit_card_id,user_id,card_number,expiry_date,is_expired,is_flagged")] Credit_Card credit_Card)
 {
     if (ModelState.IsValid)
     {
         db.Entry(credit_Card).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.user_id = new SelectList(db.Users, "user_id", "username", credit_Card.user_id);
     return(View(credit_Card));
 }
 public ActionResult Edit([Bind(Include = "invoice_id,user_id,credit_card_id,invoice_date,ship_date,is_invoice_closed")] Invoice invoice)
 {
     if (ModelState.IsValid)
     {
         db.Entry(invoice).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.credit_card_id = new SelectList(db.Credit_Card, "credit_card_id", "credit_card_id", invoice.credit_card_id);
     ViewBag.user_id        = new SelectList(db.Users, "user_id", "username", invoice.user_id);
     return(View(invoice));
 }
Example #13
0
 public ActionResult Edit([Bind(Include = "line_item_id,invoice_id,game_id,quantity,price")] Line_Item line_Item)
 {
     if (ModelState.IsValid)
     {
         db.Entry(line_Item).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.game_id    = new SelectList(db.Games, "game_id", "game_name", line_Item.game_id);
     ViewBag.invoice_id = new SelectList(db.Invoices, "invoice_id", "invoice_id", line_Item.invoice_id);
     return(View(line_Item));
 }
Example #14
0
 public ActionResult Edit([Bind(Include = "wish_list_id,user_id,game_id,date_added")] Wish_List wish_List)
 {
     if (ModelState.IsValid)
     {
         db.Entry(wish_List).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { id = wish_List.user_id }));
     }
     ViewBag.game_id = new SelectList(db.Games, "game_id", "game_name", wish_List.game_id);
     ViewBag.user_id = new SelectList(db.Users, "user_id", "username", wish_List.user_id);
     return(View(wish_List));
 }
 public ActionResult Edit([Bind(Include = "store_event_user_id,store_event_id,user_id")] Store_Event_User store_Event_User)
 {
     if (ModelState.IsValid)
     {
         db.Entry(store_Event_User).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.store_event_id = new SelectList(db.Store_Event, "store_event_id", "store_event_name", store_Event_User.store_event_id);
     ViewBag.user_id        = new SelectList(db.Users, "user_id", "username", store_Event_User.user_id);
     return(View(store_Event_User));
 }
Example #16
0
 public ActionResult Edit([Bind(Include = "user_id,address_id,address_name")] User_Address user_Address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user_Address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.address_id = new SelectList(db.Addresses, "address_id", "street_address", user_Address.address_id);
     ViewBag.user_id    = new SelectList(db.Users, "user_id", "username", user_Address.user_id);
     return(View(user_Address));
 }
 public ActionResult Edit([Bind(Include = "invoice_address_id,invoice_id,address_id,is_billing_address")] Invoice_Address invoice_Address)
 {
     if (ModelState.IsValid)
     {
         db.Entry(invoice_Address).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.address_id = new SelectList(db.Addresses, "address_id", "street_address", invoice_Address.address_id);
     ViewBag.invoice_id = new SelectList(db.Invoices, "invoice_id", "invoice_id", invoice_Address.invoice_id);
     return(View(invoice_Address));
 }
Example #18
0
 public ActionResult Edit([Bind(Include = "user_id,friend_id,is_family,date_added")] Friend_List friend_List)
 {
     if (ModelState.IsValid)
     {
         db.Entry(friend_List).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.friend_id = new SelectList(db.Users, "user_id", "username", friend_List.friend_id);
     ViewBag.user_id   = new SelectList(db.Users, "user_id", "username", friend_List.user_id);
     return(View(friend_List));
 }
Example #19
0
 public ActionResult Edit([Bind(Include = "game_id,game_name,description,cost,list_price,on_hand,developer_id,publisher_id,genre_id,release_date,is_on_sale,is_discontinued,is_downloadable,is_physical_copy,image_location")] Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.developer_id = new SelectList(db.Developers, "developer_id", "developer_name", game.developer_id);
     ViewBag.genre_id     = new SelectList(db.Genres, "genre_id", "genre_name", game.genre_id);
     ViewBag.publisher_id = new SelectList(db.Publishers, "publisher_id", "publisher_name", game.publisher_id);
     return(View(game));
 }