Esempio n. 1
0
 public void UploadFile(FileUpload newFile)
 {
     FileStream stream = null;
     try
     {
         var physicalPath = GetFullLocalPath(newFile.Path);
         stream = new FileStream(physicalPath, FileMode.Create, FileAccess.Write);
         if (stream.CanWrite)
         {
             stream.Write(newFile.Contents, 0, newFile.Contents.Length);
         }
     }
     finally
     {
         if (stream != null)
         {
             stream.Close();
         }
     }
     uploadRepository.Insert(newFile);
 }
Esempio n. 2
0
 public ActionResult UploadFile(FileUpload fileUpload)
 {
     fileUploadService.UploadFile(fileUpload);
     return RedirectToAction("Add");
 }
Esempio n. 3
0
 public string GetFullPath(FileUpload fileUpload)
 {
     return GetFullLocalPath(fileUpload.Path);
 }
Esempio n. 4
0
 public FileUpload Insert(FileUpload entity)
 {
     connection.Insert(entity);
     return entity;
 }