protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.professor_page);
            _professorRecyclerView = FindViewById <RecyclerView>(Resource.Id.professorPageRecyclerView);
            // Create your application here
            _professorLayoutManager = new LinearLayoutManager(this);
            _addProfessorButton     = FindViewById <Button>(Resource.Id.addProfessorButton);
            _professorRecyclerView.SetLayoutManager(_professorLayoutManager);
            _professorAdapter = new ProfessorAdapter();
            _professorRecyclerView.SetAdapter(_professorAdapter);
            thisRepository.LoadInstructors();
            thisProfList   = thisRepository.GetAllProfessors();
            thisProfString = setProfSpinner();
            FindView();
            LinkEventHandlers();
            var spinnerProfDelete = FindViewById <Spinner>(Resource.Id.ProfessorDeleteSpinner);

            spinnerProfDelete.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinnerProfDelete_ItemSelected);
            var profSpinnerEdit = FindViewById <Spinner>(Resource.Id.professorIdEdit);

            profSpinnerEdit.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinnerProfEdit_ItemSelected);
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, thisProfString);

            spinnerProfDelete.Adapter = adapter;
            profSpinnerEdit.Adapter   = adapter;
            var deleteformprof = FindViewById <LinearLayout>(Resource.Id.ProfessorDeleteForm);
            var editFormProf   = FindViewById <LinearLayout>(Resource.Id.ProfessorEditForm);

            deleteformprof.Visibility = ViewStates.Invisible;
            editFormProf.Visibility   = ViewStates.Invisible;
        }
Ejemplo n.º 2
0
        public ProfessorViewModel AtualizarProfessor(ProfessorViewModel model)
        {
            BeginTransaction();
            var professor = ProfessorAdapter.ToDomainModel(model);

            _professorservice.AtualizarProfessor(professor);
            Commit();
            return(model);
        }
Ejemplo n.º 3
0
        public ProfessorViewModel AdicionarProfessor(ProfessorViewModel model)
        {
            var professor = ProfessorAdapter.ToDomainModel(model);

            _professorservice.AdicionarProfessor(professor);

            model.ValidationResult = professor.ValidationResult;

            if (!professor.ValidationResult.IsValid)
            {
                return(model);
            }

            Commit();

            return(model);
        }