Ejemplo n.º 1
0
        public string DeleteYear(int id)
        {
            try
            {
                if (IDExists(id))
                {
                    Rezultati gads = _dataContext.Rezultatis.Where(f => f.ID == id).SingleOrDefault();
                    _dataContext.Rezultatis.DeleteOnSubmit(gads);
                    ArchiveRepository ar = new ArchiveRepository();
                    ar.DeleteYearByYearNumber(gads.Gads);
                    _dataContext.SubmitChanges();

                    return "Gads nodzēsts";
                }
                else return "Šāds gads neeksistē";
            }
            catch
            {
                return "Kļūda DB apstrādē";
            }
        }
Ejemplo n.º 2
0
 private int PdfInArchiveUse(string pdfName)
 {
     ArchiveRepository ar = new ArchiveRepository();
     var years = ar.GetYears();
     foreach (var year in years)
     {
         if (year.FileName == pdfName) return year.Year;
     }
     return 0;
 }