Esempio n. 1
0
 /// <summary>
 /// Tạo bài kiểm tra
 /// </summary>
 /// <param name="tes">Test</param>
 /// <returns>long</returns>
 public long CreateTest(StudyOnline.Entities.Models.Test tes)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             _db.Test.Add(tes);
             _db.SaveChanges();
             return(tes.ID);
         }
         catch (Exception)
         {
             return(-1);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Cập nhật bài kiểm tra
 /// </summary>
 /// <param name="tes">Test</param>
 /// <returns>bool</returns>
 public bool UpdateTest(StudyOnline.Entities.Models.Test tes)
 {
     using (StudyOnline.Entities.Models.StudyOnline _db = new StudyOnline.Entities.Models.StudyOnline())
     {
         try
         {
             var c = _db.Test.Find(tes.ID);
             c.Name      = tes.Name;
             c.TimeTest  = tes.TimeTest;
             c.SectionID = tes.SectionID;
             c.Point     = tes.Point;
             c.Rank      = tes.Rank;
             _db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Esempio n. 3
0
 public bool UpdateTest(StudyOnline.Entities.Models.Test tes)
 {
     return(testRepository.UpdateTest(tes));
 }
Esempio n. 4
0
 public long CreateTest(StudyOnline.Entities.Models.Test tes)
 {
     return(testRepository.CreateTest(tes));
 }