Beispiel #1
0
        public ActionResult SaveAddDocument(int RenewalId, string EffectiveDate, string ddlDocumentType, string fileName, HttpPostedFileBase UploadedImage)
        {
            byte[]       file = null;
            BinaryReader rdr  = new BinaryReader(UploadedImage.InputStream);

            file = rdr.ReadBytes((int)UploadedImage.ContentLength);

            DocumentViewModel model = new DocumentViewModel();

            model.RenewalId     = RenewalId;
            model.Action        = false;
            model.DocTypeId     = Convert.ToInt32(ddlDocumentType.ToString());
            model.EffectiveDate = Convert.ToDateTime(EffectiveDate);
            model.Extension     = Path.GetExtension(UploadedImage.FileName).Replace(".", "");
            model.FileName      = UploadedImage.FileName;
            model.FileUpload    = file;
            model.Media         = UploadedImage.ContentType;
            model.Name          = UploadedImage.FileName;

            model.AddDocument(model);

            return(Json(new { success = true }));
        }