public ActionResult Form(int?id) { var theProduct = id == null ? new product() : _productBusiness.GetTheData(id); List <product_date> theProductData = id == null ? new List <product_date>() : _product_dateBusiness.GetDataList(id); ViewData["theProduct"] = theProduct; ViewData["theProductData"] = theProductData; ViewData["emptyProductData"] = new product_date(); var _ImagesBusiness = new ImagesBusiness(); ViewData["ImagesDatas1"] = _ImagesBusiness.GetFilePath(id, "images", theProduct.images); ViewData["ImagesDatas2"] = _ImagesBusiness.GetFilePath(id, "logo", theProduct.logo); return(View()); }
public ActionResult Form(int?id) { var theProduct = id == null ? new product() : _productBusiness.GetTheData(id); ViewData["theProduct"] = theProduct; List <product_date> theProductData = id == null ? new List <product_date>() : _product_dateBusiness.GetDataList(id); ViewData["theProductData"] = theProductData; var _ImagesBusiness = new ImagesBusiness(); List <ImagesData> allImageDatas = new List <ImagesData>(); List <product_Introduction> theProductIntroduction = id == null ? new List <product_Introduction>() { new product_Introduction() { days = 1 } } : _product_IntroductionBusiness.GetDataList(id); if (theProductIntroduction == null || theProductIntroduction.Count == 0) { theProductIntroduction = new List <product_Introduction>() { new product_Introduction() { Id = "", days = 1 } }; } else { var IntroductionImages = new Dictionary <string, List <ImagesData> >() { }; foreach (var item in theProductIntroduction) { allImageDatas.AddRange(_ImagesBusiness.GetFilePath(id, item.Id, item.picture)); } ViewData["IntroductionImages"] = IntroductionImages; } ViewData["theProductIntroduction"] = theProductIntroduction; ViewData["emptyProductData"] = new product_date(); allImageDatas.AddRange(_ImagesBusiness.GetFilePath(id, "images", theProduct.images)); allImageDatas.AddRange(_ImagesBusiness.GetFilePath(id, "logo", theProduct.logo)); ViewData["allImageDatas"] = allImageDatas; return(View()); }