Example #1
0
        public async void Save()
        {
            var context = new LiteratureRegisterContext();

            context.Update(Thesis);
            await context.SaveChangesAsync();
        }
Example #2
0
        public async void Delete()
        {
            var context = new LiteratureRegisterContext();

            if (context.Theses.Any(x => x.Id == Thesis.Id))
            {
                context.Remove(Thesis);
                await context.SaveChangesAsync();
            }
        }
Example #3
0
        public void Search(string searchTerm)
        {
            if (searchTerm == "")
            {
                return;
            }

            using var context = new LiteratureRegisterContext();
            var theses = context.SearchTheses(searchTerm).ToList();

            Create(theses);
            OnPropertyChanged(nameof(Theses));
        }
Example #4
0
        private void Create()
        {
            Theses = new List <ThesisViewModel>();

            var theses = new LiteratureRegisterContext().Theses
                         .Include(x => x.Literatures)
                         .Include(x => x.ThesisType)
                         .ToList();

            foreach (var thesis in theses)
            {
                Theses.Add(new ThesisViewModel(_navigationService, thesis));
            }
        }