예제 #1
0
        public ActionResult Index(PostFiles model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var storeFile = new SignedContract();

            storeFile.SignedFile = new byte[model.File.InputStream.Length];
            storeFile.FileName = model.File.FileName;
            model.File.InputStream.Read(storeFile.SignedFile, 0, storeFile.SignedFile.Length);

            using (var db = new SignedContractContext())
            {
                db.SignedContracts.Add(storeFile);
                db.SaveChanges();
            }
            // now you could pass the byte array to your model and store wherever
            // you intended to store it

            return Content("Thanks for uploading the file");
        }
예제 #2
0
 public ActionResult Index()
 {
     var model = new PostFiles();
     return View(model);
 }