public List<string> GetSqlByPicture(List<CoursePicture> plist,int course_id) { List<string> list = new List<string>(); ICoursePictureImplMgr _p = new CoursePictureMgr(conStr); CoursePicture c = new CoursePicture(); c.course_id = course_id; list.Add(_p.Delete(c)); try { foreach (CoursePicture item in plist) { item.course_id = course_id; list.Add(_p.Save(item)); } return list; } catch (Exception ex) { throw new Exception("CourseMgr-->GetSqlByPicture" + ex, ex); } }
/// <summary> /// 獲取課程圖檔 /// </summary> /// <returns></returns> public ActionResult GetCourseImg(int course_id = 0) { List<CoursePicture> list = new List<CoursePicture>(); try { ICoursePictureImplMgr _coursePictureMgr = new CoursePictureMgr(connectionString); CoursePicture cp = new CoursePicture(); cp.course_id = course_id; imgServerPath = imgServerPath + "/course/a/"; list = _coursePictureMgr.Query(cp); for (int i = 0; i < list.Count;i++ ) { list[i].id =Convert.ToUInt32(i); list[i].picture_name = list[i].picture_name.Replace(" ", imgServerPath); } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); } return Json(new { images = list }); }