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)); }
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)); }
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(); }
// 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)); }
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)); }