예제 #1
0
파일: Slide.cs 프로젝트: jfbomber/kk
 /// <summary>
 /// DBFill
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="slide"></param>
 public static void DBFill(SqliteDataReader reader, Slide slide)
 {
     slide.SlideID = Convert.ToInt32(reader["slide_id"]);
     slide.SlideText = HttpUtility.UrlDecode(reader["slide_text"].ToString(), System.Text.Encoding.Default);
     slide.SlideIndex = Convert.ToInt32(reader["slide_index"]);
     slide.PhotoID = Convert.ToInt32(reader["photo_id"]);
     slide.Photo = Photo.Get(slide.PhotoID);
 }
예제 #2
0
 public JsonResult Save(string slide_text, int slide_index, int photo_id, int? slide_id = null)
 {
     Slide slide = new Slide();
     slide.SlideID = slide_id;
     slide.SlideText = slide_text;
     slide.SlideIndex = slide_index;
     slide.PhotoID = photo_id;
     slide.Save();
     return Json(slide);
 }
예제 #3
0
파일: Slide.cs 프로젝트: jfbomber/kk
 /// <summary>
 /// Gets all project
 /// </summary>
 /// <returns>List of slides</returns>
 public static List<Slide> GetAll()
 {
     List<Slide> slides = new List<Slide>();
     string query = "SELECT * FROM kk_slide ORDER BY slide_index;";
     // get database connection
     using (SqliteConnection conn = new SqliteConnection(connectionString))
     {
         conn.Open();
         // execute cmd
         using (SqliteCommand cmd = new SqliteCommand(query, conn))
         {
             // user reader to fill data
             using (SqliteDataReader reader = cmd.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     Slide slide = new Slide();
                     Slide.DBFill(reader, slide);
                     slides.Add(slide);
                 }
             }
         }
     }
     return slides;
 }