示例#1
0
 public NoteClass(STUDENTS_NOTES note)
 {
     this.id     = note.STUDENT_NOTE_ID;
     this.poster = new UserPublicInfoClass(note.USER_ID);
     this.note   = note.NOTE;
     this.date   = note.NOTE_DATE;
 }
示例#2
0
 public HttpResponseMessage Add(int user_id, int student_id, string note)
 {
     try
     {
         using (Entities e = new Entities())
         {
             var            pk    = e.STUDENTS_NOTES.ToList().Count == 0 ? 0 : e.STUDENTS_NOTES.Max(s => s.STUDENT_NOTE_ID);
             STUDENTS_NOTES _note = new STUDENTS_NOTES()
             {
                 STUDENT_NOTE_ID = pk + 1,
                 STUDENT_ID      = e.STUDENTS.FirstOrDefault(s => s.USER_ID == student_id).STUDENT_ID,
                 USER_ID         = user_id,
                 NOTE            = note,
                 NOTE_DATE       = DateTime.Now
             };
             e.STUDENTS_NOTES.Add(_note);
             e.SaveChanges();
             return(Request.CreateResponse(HttpStatusCode.OK, new Result()
             {
                 statusCode = 200, status = "Done"
             }));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, new Result()
         {
             statusCode = 400, status = ex.Message
         }));
     }
 }