/// <summary>
 /// 修改产品图片信息
 /// </summary>
 /// <param name="productPicture">产品图片实体</param>
 /// <returns></returns>
 public int ModifyProductPicture(ProductPicture productPicture)
 {
     return _productpicture.Update(productPicture);
 }
Beispiel #2
0
 public ActionResult UploadProductPic(HttpPostedFileBase PicName, ProductPicture pro)
 {
     try
     {
         if (!Directory.Exists(Server.MapPath("/ProductPic/")))
         {
             System.IO.Directory.CreateDirectory(Server.MapPath("/ProductPic/"));
         }
         //图片保存的地址和名称
         Random random = new Random(DateTime.Now.Millisecond);
         string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + random.Next(10000) + PicName.FileName.Substring(PicName.FileName.LastIndexOf('\\') + 1);
         string filePath = Path.Combine(HttpContext.Server.MapPath("../ProductPic/"), filename);
         if (PicName.ContentLength > 0)
         {
             Path.GetFileName(PicName.FileName);
             PicName.SaveAs(filePath);
             pro.picName = filename;
             productPictureService.AddProductPicture(pro);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     return RedirectToAction(@"ProductPicList", "admin");
 }
 /// <summary>
 /// 添加产品图片信息
 /// </summary>
 /// <param name="productPicture">产品图片实体</param>
 /// <returns></returns>
 public int AddProductPicture(ProductPicture productPicture)
 {
     return _productpicture.Insert(productPicture);
 }
Beispiel #4
0
 public ActionResult EditProductPic(ProductPicture pro)
 {
     productPictureService.ModifyProductPicture(pro);
     return RedirectToAction(@"ProductPicList", "admin");
 }