Exemple #1
0
        public Institution GetByID(int institutionID)
        {
            if (institutionID == 0) throw new ArgumentNullException("institutionID");

            InstitutionRepository repository = new InstitutionRepository();
            return repository.Select(institutionID);
        }
Exemple #2
0
        public bool Delete(int institutionID)
        {
            InstitutionRepository repository = new InstitutionRepository();
            Institution institution = repository.Select(institutionID);

            return repository.Delete(institution);
        }
Exemple #3
0
        public Institution GetByUserName(string userName)
        {
            if (String.IsNullOrWhiteSpace(userName)) throw new ArgumentNullException("userName");

            InstitutionFilter filter = new InstitutionFilter();
            filter.UserName = userName;

            InstitutionRepository repository = new InstitutionRepository();
            return repository.Select(filter).SingleOrDefault();
        }
Exemple #4
0
        public Institution Save(Institution institution)
        {
            if (institution == null) throw new ArgumentNullException("institution");

            if (String.IsNullOrEmpty(institution.Sigla))
                throw new ArgumentNullException("Neplatný parametr Sigla");

            if (String.IsNullOrEmpty(institution.Name))
                throw new ArgumentNullException("Neplatný parametr Name");

            InstitutionRepository repository = new InstitutionRepository();

            if (institution.InstitutionID == 0)
            {
                institution = repository.Create(institution);
            }
            else
            {
                institution = repository.Update(institution);
            }

            //return repository.Select(institution.institutionID);
            return institution;
        }
Exemple #5
0
 public List<Institution> GetAll()
 {
     InstitutionRepository repository = new InstitutionRepository();
     return repository.Select();
 }