Beispiel #1
0
        public void TestDocumentReadAndInsert()
        {
            var files = Directory.GetFileSystemEntries(Server.MapPath("~/Documents"), "*.pdf", SearchOption.AllDirectories);

            var bDoc = new Document();

            bDoc.DocumentBLOB = System.IO.File.ReadAllBytes(files[0]);

            using (var db = new PortugalVillasContext())
            {
                db.Documents.Add(bDoc);
                db.SaveChanges();
            }
        }
        public ActionResult Create(Document document)
        {
            if (ModelState.IsValid)
            {
                db.Documents.Add(document);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", document.BookingExtraSelectionID);
            ViewBag.CaseID = new SelectList(db.Cases, "CaseID", "CaseID", document.CaseID);
            ViewBag.EventID = new SelectList(db.Events, "EventID", "EventID", document.EventID);
            return View(document);
        }
        public void TestDocumentReadAndInsert()
        {


            var files = Directory.GetFileSystemEntries(Server.MapPath("~/Documents"), "*.pdf", SearchOption.AllDirectories);

            var bDoc = new Document();
            bDoc.DocumentBLOB = System.IO.File.ReadAllBytes(files[0]);

            using (var db = new PortugalVillasContext())
            {
                db.Documents.Add(bDoc);
                db.SaveChanges();

            }



        }
 public ActionResult Edit(Document document)
 {
     if (ModelState.IsValid)
     {
         db.Entry(document).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", document.BookingExtraSelectionID);
     ViewBag.CaseID = new SelectList(db.Cases, "CaseID", "CaseID", document.CaseID);
     ViewBag.EventID = new SelectList(db.Events, "EventID", "EventID", document.EventID);
     return View(document);
 }