public ActionResult Edit([Bind(Include = "PhotoID,Image,Title,Description,Type,Price")] MLB mLB)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mLB).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mLB));
 }
Exemple #2
0
        public ActionResult Edit([Bind(Include = "PhotoID,Image,Title,Description,Type,Price")] NFL nFl, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    nFl.Image = new byte[file.ContentLength];
                    file.InputStream.Read(nFl.Image, 0, file.ContentLength);

                    db.Entry(nFl).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View("nFl"));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "PhotoID,Image,Title,Description,Type,Price")] NFL nFl, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                if (file != null)
                {
                    SportsMemoribiliaStoreEntities db = new SportsMemoribiliaStoreEntities();
                    nFl.Image = new byte[file.ContentLength];
                    file.InputStream.Read(nFl.Image, 0, file.ContentLength);

                    db.NFLs.Add(nFl);
                    db.SaveChanges();
                }
            }

            return(RedirectToAction("../NFLs"));
        }