private async void BtnSave_Click(object sender, EventArgs e) { var _driving_test_application = await _driving_test_applicationsService.GetById <Model.DrivingTestApplications>(_id); DrivingTestApplicationsInsertRequest insertRequest = new DrivingTestApplicationsInsertRequest { InstructorId = _driving_test_application.InstructorId, CategoryId = _driving_test_application.CategoryId, CandidateId = _driving_test_application.CandidateId, Date = _driving_test_application.Date.Date, Active = checkBoxActive.Checked == true ? true : false, Passed = checkBoxPolozenPrakticniTest.Checked, }; await _driving_test_applicationsService.Update <Model.DrivingTestApplications>(_id, insertRequest); var instructorId = _driving_test_application.InstructorId; var categoryId = _driving_test_application.CategoryId; var candidateId = _driving_test_application.CandidateId; var instructor_Category_Candidate = await _instructor_categories_candidatesService.GetById <Model.Instructor_Category_Candidate>(instructorId, categoryId, candidateId); InstructorCategoryCandidateInsertRequest instructorCategoryCandidateInsertRequest = new InstructorCategoryCandidateInsertRequest { PolozenTeorijskiTest = instructor_Category_Candidate.PolozenTeorijskiTest, PolozenTestPrvePomoci = instructor_Category_Candidate.PolozenTestPrvePomoci, PolozenPrakticniTest = checkBoxPolozenPrakticniTest.Checked, Prijavljen = checkBoxActive.Checked == true ? true : false, NumberOfLessons = instructor_Category_Candidate.NumberOfLessons, Paid = instructor_Category_Candidate.Paid, Date = (instructor_Category_Candidate.Date != null) ? (DateTime?)instructor_Category_Candidate.Date.Value : null, }; await _instructor_categories_candidatesService.Update <Model.Instructor_Category_Candidate>(instructorId, categoryId, candidateId, instructorCategoryCandidateInsertRequest); }
public async Task Submit(object candidates) { var Candidates = candidates as List <Candidate>; DrivingTestApplicationsInsertRequest insert_request = new DrivingTestApplicationsInsertRequest(); var instructors_categories = await _instructor_categoriesService.GetAll <List <Instructor_Category> >(request2); InstructorCategoryCandidateSearchRequest request3 = new InstructorCategoryCandidateSearchRequest(); InstructorCategoryCandidateInsertRequest request4 = new InstructorCategoryCandidateInsertRequest(); int count = 0; foreach (var instructor_category in instructors_categories) { request3.InstructorId = instructor_category.InstructorId; request3.CategoryId = instructor_category.CategoryId; foreach (var candidate in Candidates) { request3.CandidateId = candidate.Id; request3.PolozenTeorijskiTest = true; request3.PolozenTestPrvePomoci = true; request3.PolozenPrakticniTest = false; request3.Prijavljen = false; var instructors_categories_candidates = await _instructor_categories_candidateService.GetAll <List <Instructor_Category_Candidate> >(request3); foreach (var instructor_category_candidate in instructors_categories_candidates) { insert_request.InstructorId = instructor_category_candidate.InstructorId; insert_request.CategoryId = instructor_category_candidate.CategoryId; insert_request.CandidateId = instructor_category_candidate.CandidateId; insert_request.Date = DateTime.Now.Date; insert_request.Passed = false; insert_request.Active = true; await _driving_test_applicationsService.Insert <DrivingTestApplications>(insert_request); count++; request4.PolozenTestPrvePomoci = instructor_category_candidate.PolozenTestPrvePomoci; request4.PolozenTeorijskiTest = instructor_category_candidate.PolozenTeorijskiTest; request4.PolozenPrakticniTest = instructor_category_candidate.PolozenPrakticniTest; request4.Prijavljen = true; request4.NumberOfLessons = instructor_category_candidate.NumberOfLessons; request4.Paid = instructor_category_candidate.Paid; await _instructor_categories_candidateService.Update <Instructor_Category_Candidate>(instructor_category_candidate.InstructorId, instructor_category_candidate.CategoryId, instructor_category_candidate.CandidateId, request4); } } } await Application.Current.MainPage.DisplayAlert("", "You have successfully submitted " + count + " request", "OK"); }