public ActionResult FileUpload(AdminAddPicViewModel model, HttpPostedFileBase file)
        {
            var code = model.Design.DesignCode;

            if (!_finalDesignService.HasImg(code))
            {
                if (file != null && file.ContentLength > 0)
                {
                    string pic  = System.IO.Path.GetFileName(file.FileName);
                    string path = System.IO.Path.Combine(Server.MapPath("~/App_Data/uploads"), pic);
                    file.SaveAs(path);
                    FinalDesignModel design = new FinalDesignModel();
                    design.DesignCode = model.Design.DesignCode;
                    design.Image      = path;
                    _finalDesignService.SaveFinalDesign(design);
                }
                return(View("Index"));
            }
            else
            {
                return(View("PictureExists"));
            }
        }
Beispiel #2
0
 public void SaveFinalDesign(FinalDesignModel fd)
 {
     _finalDesignRepository.SaveFinalDesign(fd.GetRepoFinalDesign());
 }
 public string SaveDesign(FinalDesignModel model)
 {
     _finalDesignService.SaveFinalDesign(model);
     return("Design Saved with an Image");
 }