Exemplo n.º 1
0
 public ActionResult Düzenle(UrunTable genel)
 {
     try
     {
         db.Entry(genel).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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());
            }
        }