コード例 #1
0
        public ActionResult MaterialsOK(CMaterials aMaterials)
        {
            int tmpBool;

            ViewBag.theWriter = aMaterials.theWriter;
            ViewBag.theTitle  = aMaterials.theTitle;
            //ViewBag.theAttachFile = aMaterials.theAttachFile;
            ViewBag.theDate = aMaterials.theDate.ToString("yyyy.MM.dd");

            //"~/Material"
            //ViewBag.theAttachFile

            HttpPostedFileBase file = aMaterials.theFile;

            string ext = Path.GetExtension(file.FileName);
            //			string tmpFileName = Path.GetRandomFileName() + "." + ext;
            string tmpFileName = Path.GetRandomFileName() + ext;
            string path        = Path.Combine(Server.MapPath("~/Material"), tmpFileName);

            file.SaveAs(path);
            //			aFileName = Path.GetFileName( file.FileName );
            //			aHDDName = tmpFileName;

            aMaterials.theFileName   = file.FileName;
            aMaterials.theAttachFile = tmpFileName;

            tmpBool = CInstance.theMaterialsMananger.AddMaterials(ref aMaterials);
            //return View(aMaterials);\
            return(RedirectToAction("Materials"));
        }
コード例 #2
0
        public ActionResult Materials(CMaterials aMaterials)
        {
            int tmpBool;

            tmpBool = CInstance.theMaterialsMananger.AddMaterials(ref aMaterials);
            if (tmpBool == 1)
            {
                return(RedirectToAction("Materials"));
            }

            return(View(aMaterials));
        }