public bool AddUploadRecordForTeachers(UploadRecordForTeacher uploadRecordForTeacher) { db.UploadRecordForTeachers.Add(uploadRecordForTeacher); int count = db.SaveChanges(); if (count != 0) { return(true); } return(false); }
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 }); }
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 }); }
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 }); }