public Catalogue Save(Catalogue catalogue) { if (catalogue == null) throw new ArgumentNullException("catalogue"); if (String.IsNullOrEmpty(catalogue.Name)) throw new ArgumentNullException("Neplatný parametr Name"); CatalogueRepository repository = new CatalogueRepository(); if (catalogue.CatalogueID == 0) { catalogue.Created = DateTime.Now; catalogue.Modified = catalogue.Created; catalogue = repository.Create(catalogue); } else { catalogue.Modified = DateTime.Now; catalogue = repository.Update(catalogue); } return catalogue; }
public string GetScanDirPath(Catalogue catalogue) { if (catalogue == null) throw new ArgumentNullException("catalogue"); if (String.IsNullOrEmpty(catalogue.DatabaseName)) throw new ArgumentNullException("DatabaseName"); string path = null; try { path = Path.Combine(App.REPOSITORY_DIR, catalogue.DatabaseName); if (!Directory.Exists(path)) Directory.CreateDirectory(path); } catch (Exception ex) { throw new ArgumentException(String.Format("Chyba při vytváření složky pro katalog: '{0}'", ex.Message)); } return path; }