示例#1
0
        public ActionResult CreatePackage(AddNewPackageViewModel newPackageViewModel, List <HttpPostedFileBase> files)
        {
            //HttpFileCollectionBase files = Request.Files;
            newPackageViewModel.OtherPictures = new List <string>();

            //HttpPostedFileBase file = Request.Files["ProfilePicture"];
            var path = SaveFileToDirectory(Request.Files["ProfilePicture"]);

            newPackageViewModel.ProfilePicSource = path;
            newPackageViewModel.OtherPictures.Add(path);

            foreach (var file in files)
            {
                path = SaveFileToDirectory(file);
                newPackageViewModel.OtherPictures.Add(path);
            }
            _packageService.AddNewPackage(newPackageViewModel);


            return(RedirectToAction("Index", "Admin"));
        }