Exemplo n.º 1
0
        public bool AddUploadRecordForTeachers(UploadRecordForTeacher uploadRecordForTeacher)
        {
            db.UploadRecordForTeachers.Add(uploadRecordForTeacher);
            int count = db.SaveChanges();

            if (count != 0)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 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
            });
        }
Exemplo n.º 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
            });
        }
Exemplo n.º 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
            });
        }