public IHttpActionResult AddEntry(Entry entry) { // To call this method: // DEV: http://localhost:52051/Api/AttendanceEntry/AddEntry // PROD: http://ktkaciovaite-001-site1.ctempurl.com/Api/AttendanceEntry/AddEntry var studentDataService = new StudentDataService(); var students = studentDataService.GetAll(); if (students.Exists(x => x.CardNumber == entry.CardNumber)) { var attendanceEntryDataService = new AttendanceEntryDataService(); var attendanceEntry = new AttendanceEntry() { Time = DateTime.Now, CardNumber = entry.CardNumber }; attendanceEntryDataService.Add(attendanceEntry); var updateAttendanceThread = new Thread(() => UpdateAttendance(attendanceEntry.Time, attendanceEntry.CardNumber)); updateAttendanceThread.Start(); return(Ok("Pažymėta")); } return(Ok("Kortelės nėra sistemoje")); }
/// <summary> /// Loads all Students From the Database /// </summary> /// <returns></returns> public static StudentCollection Load() { try { //Create a Student Data Service Object StudentDataService dataService = new StudentDataService(); // Call the GETAll() method which returns a populated DataSet DataSet ds = dataService.GetAll(); StudentCollection obj = new StudentCollection(); //Create Student Objects from DataSet and add the objects to the collection obj.MapObjects(ds); // Return the populated collection return(obj); } catch (Exception ex) { throw new System.Exception(ex.Message); } }
private void InitValues() { studentDataService = new StudentDataService(); Students = new ObservableCollection <Student>(studentDataService.GetAll()); }