public ActionResult Düzenle(UrunTable genel) { try { db.Entry(genel).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Sil(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UrunTable genel = db.UrunTable.Find(id); if (genel == null) { return(HttpNotFound()); } return(View(genel)); }
public ActionResult Detay(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UrunTable u = db.UrunTable.Find(id); if (u == null) { return(HttpNotFound()); } return(View(u)); }
public ActionResult Create(UrunTable u, HttpPostedFileBase Foto) { if (ModelState.IsValid) { if (Foto != null) { WebImage img = new WebImage(Foto.InputStream); FileInfo fotoinfo = new FileInfo(Foto.FileName); string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension; img.Resize(800, 350); img.Save("~/UFoto/" + newfoto); u.UrunResmi = "/UFoto/" + newfoto; } db.UrunTable.Add(u); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(u)); }
public ActionResult Sil(int id, UrunTable gnl) { UrunTable genel = new UrunTable(); try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } genel = db.UrunTable.Find(id); if (genel == null) { return(HttpNotFound()); } db.UrunTable.Remove(genel); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }