コード例 #1
0
ファイル: ManagerController.cs プロジェクト: Alvinidea/Web_CC
        public ActionResult ManageClassroom_Add(int num, int bid, int mateNum)
        {
            Classroom_table classroom = new Classroom_table();

            classroom.NumClassroom       = num;
            classroom.IDBuilding         = bid;
            classroom.PeopleNumClassroom = mateNum;
            if (1 == new OperationClassroomData().Add(classroom))
            {
                return(Json(new { msg = "successd" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { msg = "Failed" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
 /// <summary>
 /// 形参为Classroom_table 对象 根据编号修改对象信息
 /// </summary>
 /// <param name="obj"></param>
 public override int Modify(Object obj)
 {
     try
     {
         Classroom_table stu  = obj as Classroom_table;
         var             user = (from e in db.Classroom_table
                                 where e.IDClassroom == stu.IDClassroom
                                 select e).FirstOrDefault();
         user = stu;
         db.SaveChanges();
         return(1);
     }
     catch (Exception e)
     {
         return(0);
     }
 }
コード例 #3
0
        public void TestData2()
        {
            Classroom_table classroom = new Classroom_table();

            classroom.IDBuilding         = 70002;
            classroom.NumClassroom       = 1234;
            classroom.PeopleNumClassroom = 60;
            db.Classroom_table.Add(classroom);

            Student_table ar = new Student_table();

            ar.IDAuthority     = 10001;
            ar.NumberStudent   = "000000";
            ar.PasscodeStudent = "000000";
            ar.NameStudent     = "000000";
            ar.GradeStudent    = 3;
            db.Student_table.Add(ar);

            Teacher_table teacher = new Teacher_table();

            teacher.IDAuthority     = 10003;
            teacher.NumberTeacher   = "000000";
            teacher.NameTeacher     = "000000";
            teacher.PasscodeTeacher = "000000";
            db.Teacher_table.Add(teacher);

            Arranger_table ada = new Arranger_table();

            ada.IDAuthority      = 10000;
            ada.NameArranger     = "000000";
            ada.NumberArranger   = "000000";
            ada.PasscodeArranger = "000000";
            db.Arranger_table.Add(ada);

            db.SaveChanges();
        }