예제 #1
0
        public bool AddUploadRecordForTeachers(UploadRecordForTeacher uploadRecordForTeacher)
        {
            db.UploadRecordForTeachers.Add(uploadRecordForTeacher);
            int count = db.SaveChanges();

            if (count != 0)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        public MainResponse.DefaultResponse AddUploadRecordForTeacher(UploadRecordForTeacher uploadRecordForTeacher)
        {
            bool operate = false;

            if (!UploadRecordForTeacherExists(uploadRecordForTeacher.sourceId))
            {
                db.UploadRecordForTeachers.Add(uploadRecordForTeacher);
                int count = db.SaveChanges();
                if (count != 0)
                {
                    operate = true;
                }
            }
            return(new MainResponse.DefaultResponse()
            {
                operate = operate
            });
        }
예제 #3
0
        public MainResponse.DefaultResponse ModifyUploadRecordForTeacher(UploadRecordForTeacher uploadRecordForTeacher)
        {
            bool operate = false;

            if (UploadRecordForTeacherExists(uploadRecordForTeacher.sourceId))
            {
                db.Entry(uploadRecordForTeacher).State = EntityState.Modified;
                int count = db.SaveChanges();
                if (count != 0)
                {
                    operate = true;
                }
            }
            return(new MainResponse.DefaultResponse()
            {
                operate = operate
            });
        }
예제 #4
0
        public MainResponse.DefaultResponse DeleteUploadRecordForTeacher(UploadRecordForTeacher uploadRecordForTeacher)
        {
            bool operate = false;
            UploadRecordForTeacher uploadRecord = db.UploadRecordForTeachers.Find(uploadRecordForTeacher.userId, uploadRecordForTeacher.sourceId);

            if (uploadRecordForTeacher != null)
            {
                db.UploadRecordForTeachers.Remove(uploadRecord);
                int count = db.SaveChanges();
                if (count != 0)
                {
                    operate = true;
                }
            }
            return(new MainResponse.DefaultResponse()
            {
                operate = operate
            });
        }