示例#1
0
 /// <summary>
 /// 添加宣传图片信息
 /// </summary>
 /// <param name="productPicture">宣传图片实体</param>
 /// <returns></returns>
 public int AddAdpic(Adpic adpic)
 {
     return _adpic.Insert(adpic);
 }
示例#2
0
 public ActionResult UploadDepartmentPic(Adpic adpic, HttpPostedFileBase picName)
 {
     try
     {
         if (!Directory.Exists(Server.MapPath("/DepartmentPic/" + adpic.language)))
         {
             System.IO.Directory.CreateDirectory(Server.MapPath("/DepartmentPic/" + adpic.language));
         }
         //图片保存的地址和名称
         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("../DepartmentPic/" + adpic.language), filename);
         if (picName.ContentLength > 0)
         {
             Path.GetFileName(picName.FileName);
             picName.SaveAs(filePath);
             adpic.picName = filename;
             adpicService.AddAdpic(adpic);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return Content(e.Message);
     }
     return RedirectToAction(@"DepartmentList", "admin");
 }
示例#3
0
 /// <summary>
 /// 修改宣传图片信息
 /// </summary>
 /// <param name="productPicture">宣传图片实体</param>
 /// <returns></returns>
 public int ModifyAdpic(Adpic adpic)
 {
     return _adpic.Update(adpic);
 }
示例#4
0
 public ActionResult EditAdpic(Adpic adpic)
 {
     adpicService.ModifyAdpic(adpic);
     return RedirectToAction(@"DepartmentList", "admin");
 }