コード例 #1
0
        public void basicInfo()
        {
            Dorm_table dorm = new Dorm_table();

            dorm.NumDorm   = 6125;
            dorm.CountDorm = 6;
            db.Dorm_table.Add(dorm);

            Building_table building = new Building_table();

            building.NameBuilding  = "殒命楼";
            building.NumBuilding   = 1000;
            building.CountBuilding = 120;
            db.Building_table.Add(building);

            Schoolhour_table schoolhour = new Schoolhour_table();

            schoolhour.TimesectionSchoolhour       = 1;
            schoolhour.TimesectionSchoolhourDetail = 2;
            db.Schoolhour_table.Add(schoolhour);

            Course_table course = new Course_table();

            course.NumberCourse    = "1000";
            course.NameCourse      = "高数";
            course.ScoreCourse     = 4;
            course.StudyTimeCourse = 70;
            course.ProfileCourse   = "牛逼的很";
            db.Course_table.Add(course);

            db.SaveChanges();
        }
コード例 #2
0
ファイル: ManagerController.cs プロジェクト: Alvinidea/Web_CC
 /// <summary>
 /// 课程信息 增删改查 表
 /// </summary>
 /// <returns></returns>
 public ActionResult ManageCourse_Add([Bind(Exclude = "IDCourse")] Course_table course)
 {
     if (1 == new OperationCourseData().Add(course))
     {
         return(Json(new { msg = "Successd" }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { msg = "Failed" }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #3
0
 /// <summary>
 /// 形参为Course_table 对象 根据编号修改对象信息
 /// </summary>
 /// <param name="obj"></param>
 public override int Modify(Object obj)
 {
     try
     {
         Course_table stu  = obj as Course_table;
         var          user = (from e in db.Course_table
                              where e.NumberCourse == stu.NumberCourse
                              select e).FirstOrDefault();
         user = stu;
         db.SaveChanges();
         return(1);
     }
     catch (Exception e)
     {
         return(0);
     }
 }