async Task Save() { if (String.IsNullOrWhiteSpace(Student.studentID) && String.IsNullOrWhiteSpace(Student.firstName) && String.IsNullOrWhiteSpace(Student.courseID) && String.IsNullOrWhiteSpace(Student.idNumber) && String.IsNullOrWhiteSpace(Student.password)) { await _pageService.DisplayAlert("Error", "Please enter All the Fields", "OK"); return; } if (Student.id == 0) { await _studentStore.AddStudent(Student); StudentAdded?.Invoke(this, Student); } else { await _studentStore.UpdateStudent(Student); StudentUpdated?.Invoke(this, Student); } await _pageService.PopModalAsync(); }
public void Handle(StudentUpdated @event) { using (var context = new ProjectionContext(ConnectionString.Get())) { var entity = context.Students.Find(@event.AggregateId); if (entity == null) { throw new EntityNotFoundException(@event.AggregateId, "Stagiaires"); } entity.Lastname = @event.Lastname; entity.Firstname = @event.Firstname; context.SaveChanges(); } }
public static void OnStudentUpdated() { StudentUpdated?.Invoke(new object(), EventArgs.Empty); }
public void Apply(StudentUpdated @event) { FirstMidName = @event.FirstMidName; LastName = @event.LastName; EnrollmentDate = @event.EnrollmentDate; }
public void Handle(StudentUpdated @event) { }