// GET: belgeler/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                belge belge = db.belgeler.Find(id);
                if (belge == null)
                {
                    return(HttpNotFound());
                }
                belge.silindiMi       = true;
                db.Entry(belge).State = EntityState.Modified;
                db.SaveChanges();
                return(Redirect("~/belgeler/index"));
            }



            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
        public ActionResult Edit([Bind(Include = "id,belgeYolu,isim,silindiMi")] belge belge, HttpPostedFileBase file)
        {
            if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
            {
                if (ModelState.IsValid)
                {
                    if (file != null && file.ContentLength > 0)
                    {
                        try
                        {
                            string path     = "";
                            string filePath = "";
                            path = Path.Combine(Server.MapPath("~/Belgeler/"),
                                                Path.GetFileName(file.FileName));
                            filePath = "~/Belgeler/" + file.FileName;
                            file.SaveAs(path);
                            //ViewBag.Message = "Dosya yükleme başarılı";
                            belge.belgeYolu = filePath;
                        }
                        catch (Exception ex)
                        {
                            //ViewBag.Message = "Hata:" + ex.Message.ToString();
                        }
                    }
                    else
                    {
                        //ViewBag.Message = "Lütfen dosya seçiniz.";
                    }


                    db.Entry(belge).State = EntityState.Modified;
                    db.SaveChanges();

                    return(Redirect("~/belgeler/index"));
                }
                return(RedirectToAction("index", "belgeler"));
            }
            else
            {
                return(RedirectToAction("index", "giris"));
            }
        }
 // GET: belgeler/Details/5
 public ActionResult Details(int?id)
 {
     if (Convert.ToInt32(Session["kulTip"]) == 1 && !String.IsNullOrEmpty(Session["kulId"].ToString()))
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         belge belge = db.belgeler.Find(id);
         if (belge == null)
         {
             return(HttpNotFound());
         }
         return(View(belge));
     }
     else
     {
         return(RedirectToAction("index", "giris"));
     }
 }