public ActionResult Create([Bind(Include = "id_Product,name,price,description,state,barcode,picture,fk_Shopid_Shop")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.fk_Shopid_Shop = new SelectList(db.Shops, "id_Shop", "name", product.fk_Shopid_Shop);
            return(View(product));
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "id_Subscription,receit_discord,receit_email,fk_Personid_Person,fk_Newsletterid_Newsletter")] Subscription subscription)
        {
            if (ModelState.IsValid)
            {
                db.Subscriptions.Add(subscription);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.fk_Newsletterid_Newsletter = new SelectList(db.Newsletters, "id_Newsletter", "newest_message", subscription.fk_Newsletterid_Newsletter);
            ViewBag.fk_Personid_Person         = new SelectList(db.People, "id_Person", "name", subscription.fk_Personid_Person);
            return(View(subscription));
        }
        public ActionResult Update(Search_parameters updatedParameters)
        {
            ITProjektasDB     db = new ITProjektasDB();
            Search_parameters notupdatedParameters = db.Search_parameters.SingleOrDefault(
                x => x.id_Search_parameters == updatedParameters.id_Search_parameters
                );

            if (notupdatedParameters != null)
            {
                db.Entry(notupdatedParameters).CurrentValues.SetValues(updatedParameters);
            }
            db.SaveChanges();

            return(RedirectToAction("GetLearningParameters", "LearningParameters"));
        }
        public ActionResult ClassifyPictures(Unclassified_pictures[] pictures)
        {
            ITProjektasDB db = new ITProjektasDB();

            foreach (var item in pictures)
            {
                Unclassified_pictures notupdatedParameters = db.Unclassified_pictures.SingleOrDefault(
                    x => x.id_Unclassified_pictures == item.id_Unclassified_pictures
                    );
                if (notupdatedParameters != null)
                {
                    db.Entry(notupdatedParameters).CurrentValues.SetValues(item);
                }
                db.SaveChanges();
            }
            return(RedirectToAction("getUnClassifiedPictures", "PictureClassifiaction"));
        }