Esempio n. 1
0
        public object Save(int id, string name, int address)
        {
            var a      = new NHRepository <Address>();
            var s      = new NHRepository <SchoolType>();
            var school = repository.Get(id);

            school.Name      = name;
            school.Addresses = new List <Address>()
            {
                a.Get(address)
            };
            s.Close();
            a.Close();

            repository.Update(school);

            return(0);
        }
Esempio n. 2
0
        public object Add(string name, int address)
        {
            var a      = new NHRepository <Address>();
            var s      = new NHRepository <SchoolType>();
            var school = new School()
            {
                Addresses = new List <Address>()
                {
                    a.Get(address)
                },
                BelongToUniversityDistrict = false,
                Name        = name,
                Number      = 0,
                Type        = s.Get(1),
                HasPriority = false,
            };

            s.Close();
            a.Close();

            return(repository.Add(school));
        }