Example #1
0
 private void SavePrice(int courseId, decimal price, int level, int currentUser)
 {
     if (price >= 0)
     {
         bool exist  = false;
         var  result = CoursePriceRepository.GetEntity(courseId, level);
         if (result == null)
         {
             result = new Yw_CoursePrice
             {
                 Yce_CourseId      = courseId,
                 Yce_SchoolLevelId = level,
                 Yce_CreateTime    = Clock.Now,
                 Yce_Creator       = currentUser
             };
         }
         else
         {
             exist = true;
             result.EnableAudit();
         }
         result.Yce_Price      = price;
         result.Yce_UpdateTime = Clock.Now;
         result.Yce_Editor     = currentUser;
         if (exist)
         {
             CoursePriceRepository.Update(result);
         }
         else
         {
             CoursePriceRepository.Insert(result);
         }
     }
 }
        public void CoursePriceRepository_GetEntity_ShouldReturnValue()
        {
            CoursePriceRepository repository = new CoursePriceRepository();
            var result = repository.GetEntity(10018, 10002);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Yce_Id == 10008);
        }