Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            lg lg = db.lgs.Find(id);

            db.lgs.Remove(lg);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult lg_detail(int?id)
        {
            NewTempEntities4 db6 = new NewTempEntities4();

            lg huawei_products = db6.lgs.Where(m => m.id == id).Single();

            return(View(huawei_products));
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "id,url,name,price,ram,rom,backcam,frontcam,color")] lg lg)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lg).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lg));
 }
Пример #4
0
        public void Post([FromBody] lgview v)
        {
            MysqlDbContext db = new MysqlDbContext();
            lg             g  = new lg
            {
                ip = v.ii,
                gz = v.gg,
                bs = v.bb
            };

            db.LG.Add(g);
            db.SaveChanges();
        }
Пример #5
0
        // GET: /Lg/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            lg lg = db.lgs.Find(id);

            if (lg == null)
            {
                return(HttpNotFound());
            }
            return(View(lg));
        }
Пример #6
0
        public ActionResult Create(lg lg)
        {
            if (ModelState.IsValid)
            {
                string fileName  = Path.GetFileNameWithoutExtension(lg.ImageFile.FileName);
                string extension = Path.GetExtension(lg.ImageFile.FileName);
                fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                lg.url   = "~/Image/" + fileName;
                fileName = Path.Combine(Server.MapPath("~/Image"), fileName);
                lg.ImageFile.SaveAs(fileName);

                db.lgs.Add(lg);

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

            return(View(lg));
        }