public ActionResult Detay(HttpPostedFileBase[] files, int id)
        {
            if (ModelState.IsValid)
            {   //iterating through multiple file collection
                foreach (HttpPostedFileBase file in files)
                {
                    //Checking file is available to save.
                    if (file != null)
                    {
                        Random rand          = new Random();
                        var    randomValue   = rand.Next(1000, 10000);
                        var    InputFileName = Path.GetFileName(file.FileName);
                        InputFileName = randomValue + "_" + InputFileName;

                        CariDosyalar dosya = new CariDosyalar();
                        dosya.yuklenmeTarihi = DateTime.Now;
                        dosya.path           = "/Uploads/CariUploads/" + InputFileName;
                        dosya.cariId         = id;
                        dosya.sil            = false;
                        var ServerSavePath = Path.Combine(Server.MapPath("~/Uploads/CariUploads/") + InputFileName);

                        //Save file to server folder
                        file.SaveAs(ServerSavePath);
                        //assigning file uploaded status to ViewBag for showing message to user.
                        db.CariDosyalar.Add(dosya);
                        db.SaveChanges();
                    }
                }
            }
            var mymessage = "Dosya Yükleme İşlemi Başarılı.";

            return(RedirectToAction("Detay/" + id, new { @message = mymessage }));
        }
        public ActionResult dosyaSil(int id)
        {
            CariDosyalar dosya = new CariDosyalar();

            dosya = db.CariDosyalar.Find(id);
            db.CariDosyalar.Remove(dosya);
            db.SaveChanges();
            string fullPath = Request.MapPath(dosya.path);

            if (System.IO.File.Exists(fullPath))
            {
                System.IO.File.Delete(fullPath);
            }


            return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString()));
        }