Beispiel #1
0
        public ActionResult AddImage(App_Class.Images image, int ID)
        {
            foreach (var folder in image.Folders)
            {
                if (folder.ContentLength > 0)
                {
                    //dosya adı ve adresi
                    var folderName = Guid.NewGuid() + Path.GetExtension(folder.FileName);
                    var adress     = Path.Combine(Server.MapPath("~/VeterinerImages"), folderName);
                    folder.SaveAs(adress);

                    //veritabanına kaydet->

                    IndexSlider r = db.IndexSlider.FirstOrDefault(x => x.ID == ID);
                    r.ImagePath = folderName;
                    db.SaveChanges();
                }
                else
                {
                    ViewBag.Mesaj = "Yükleme işlemi yapılamadı!";
                    return(View());
                }
            }
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            IndexSlider indexSlider = db.IndexSlider.Find(id);

            db.IndexSlider.Remove(indexSlider);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "ID,Title,Statement,ImagePath")] IndexSlider indexSlider)
 {
     if (ModelState.IsValid)
     {
         db.Entry(indexSlider).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(indexSlider));
 }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "ID,Title,Statement")] IndexSlider indexSlider)
        {
            if (ModelState.IsValid)
            {
                db.IndexSlider.Add(indexSlider);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(indexSlider));
        }
Beispiel #5
0
        // GET: IndexSliders/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IndexSlider indexSlider = db.IndexSlider.Find(id);

            if (indexSlider == null)
            {
                return(HttpNotFound());
            }
            return(View(indexSlider));
        }
Beispiel #6
0
        public ActionResult AddImage(int ID)
        {
            IndexSlider inds = db.IndexSlider.Find(ID);

            return(View(inds));
        }