public async void Save() { var context = new LiteratureRegisterContext(); context.Update(Thesis); await context.SaveChangesAsync(); }
public async void Delete() { var context = new LiteratureRegisterContext(); if (context.Theses.Any(x => x.Id == Thesis.Id)) { context.Remove(Thesis); await context.SaveChangesAsync(); } }
public void Search(string searchTerm) { if (searchTerm == "") { return; } using var context = new LiteratureRegisterContext(); var theses = context.SearchTheses(searchTerm).ToList(); Create(theses); OnPropertyChanged(nameof(Theses)); }
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)); } }