public IActionResult CreateSubject([FromBody] RegisterSubject registerSubject) { try { context.RegisterSubjects.Add(registerSubject); context.SaveChanges(); return(Ok("True")); } catch (Exception) { return(Ok("False")); } }
public IActionResult Create([FromBody] ProfileTeacher profileTeacher) { try { // profileTeacher.ProfileId = Guid.NewGuid() + ""; context.ProfileTeachers.Add(profileTeacher); context.SaveChanges(); return(Ok(true)); } catch { return(Ok(false)); } }
public IActionResult CreateContact([FromBody] Contact contact) { try { contact.Id = Guid.NewGuid() + ""; context.Contacts.Add(contact); context.SaveChanges(); return(Ok(true)); } catch { return(Ok(false)); } }
public IActionResult CreateSubject([FromBody] Subject subject) { try { context.Subjects.Add(subject); context.SaveChanges(); return(Ok("true")); } catch { return(Ok("false")); } }
public IActionResult Create([FromBody] Teacher _Teacher) { try { // _Teacher.TeacherId = Guid.NewGuid().ToString(); //Guid: tạo id là duy nhất context.Teachers.Add(_Teacher); context.SaveChanges(); return(Ok(true)); } catch (Exception e) { return(Ok(e.Message)); }; }
public IActionResult Create([FromBody] Student student) { try { // student.StudentId = Guid.NewGuid() + ""; //Guid: tạo id là duy nhất context.Students.Add(student); context.SaveChanges(); return(Ok(true)); } catch { return(Ok(false)); }; }
public IActionResult AddNotification([FromBody] Notification notification) { try { notification.Id = Guid.NewGuid() + ""; context.Notifications.Add(notification); context.SaveChanges(); return(Ok(true)); } catch { return(Ok(false)); } }
public Boolean AddEventGuestToDbContext(EventGuest guest) { if (String.IsNullOrEmpty(guest.Email)) { return(false); } if (context.EventGuests.Count(g => g.Email.Equals(guest.Email)) > 0) { return(false); } if (guest.Preregistered == false) { guest.TimeOfCheckIn = service.GetCurrentDateTimeWithOffSet(); } context.EventGuests.Add(guest); context.SaveChanges(); return(true); }
public IActionResult CreateAttendanceRollCall([FromBody] AttendanceRollCall attendanceRollCall) { try { attendanceRollCall.Id = Guid.NewGuid() + ""; context.AttendanceRollCalls.Add(attendanceRollCall); context.SaveChanges(); return(Ok(true)); } catch { return(Ok(false)); } }
public IActionResult ChangePasswordStudent([FromBody] string password, string studentID) { var entity = context.Students.FirstOrDefault(e => e.StudentId.Equals(studentID)); if (entity != null) { try { entity.Password = password; context.Students.Update(entity); context.SaveChanges(); return(Ok(true)); } catch (Exception) { return(Ok(false)); } } return(Ok(false)); }
public IActionResult UpdatePersonIDAndFaceID(string personID, string studentID) { var entity = context.Students.FirstOrDefault(e => e.StudentId.Equals(studentID)); //tìm sinh viên (theo id sv) if (entity != null) { try { entity.PersonId = personID; context.Students.Update(entity); context.SaveChanges(); return(Ok(true)); } catch (Exception) { return(Ok(false)); } } return(Ok(false)); }