/// <summary> /// Saves a correspondence letter from the posted data /// </summary> /// <param name="PermitKey"></param> /// <param name="CorrespondenceType"></param> /// <returns></returns> private CorrespondenceBO SaveLetterFile(int PermitKey, ENUMBLL.PDFDocuments CorrespondenceType) { // Gets the posted file from the request HttpPostedFileBase File = Request.Files["File"]; // Build the letter data object CorrespondenceDO data = new CorrespondenceDO() { CorrespondenceId = 0, CorrespondenceType = CorrespondenceType.ToString(), DateUploaded = DateTime.Now, FileName = File.FileName, FileSize = File.ContentLength, MimeType = File.ContentType, Guid = Guid.NewGuid(), Name = ENUMBLL.EnumDescription(CorrespondenceType), PermitKey = PermitKey, UserToken = myCoalUser.UserToken, Approved = false }; // read content from stream byte[] content = new byte[File.ContentLength]; File.InputStream.Read(content, 0, (int)File.ContentLength); // post the information to create a new business object CorrespondenceBO letter = CorrespondenceBLL.AddCorrespondence(data, content, DirectoryMapping.CorrespondenceFolder); return letter; }
/// <summary> /// A partial view used to upload and approve correspondence letters /// </summary> /// <param name="PermitKey"></param> /// <param name="Type"></param> /// <returns></returns> public ActionResult LetterUploader(int PermitKey, ENUMBLL.PDFDocuments Type) { CorrespondenceDO DataObject = new CorrespondenceDO() { CorrespondenceType = Type.ToString(), PermitKey = PermitKey }; CorrespondenceBO model = new CorrespondenceBO() { DataObject = DataObject }; return PartialView(model); }