Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            samsung samsung = db.samsungs.Find(id);

            db.samsungs.Remove(samsung);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult products_detail(int?id)
        {
            NewTempEntities4 db6 = new NewTempEntities4();

            samsung samsung_products = db6.samsungs.Where(m => m.id == id).Single();

            return(View(samsung_products));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "id,url,name,price,ram,rom,backcam,frontcam,color")] samsung samsung)
 {
     if (ModelState.IsValid)
     {
         db.Entry(samsung).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(samsung));
 }
Esempio n. 4
0
        // GET: /Samsung/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            samsung samsung = db.samsungs.Find(id);

            if (samsung == null)
            {
                return(HttpNotFound());
            }
            return(View(samsung));
        }
Esempio n. 5
0
        public ActionResult Create(samsung samsung)
        {
            if (ModelState.IsValid)
            {
                string fileName  = Path.GetFileNameWithoutExtension(samsung.ImageFile.FileName);
                string extension = Path.GetExtension(samsung.ImageFile.FileName);
                fileName    = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                samsung.url = "~/Image/" + fileName;
                fileName    = Path.Combine(Server.MapPath("~/Image"), fileName);
                samsung.ImageFile.SaveAs(fileName);

                db.samsungs.Add(samsung);

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(samsung));
        }