예제 #1
0
        public domain.TehnologijaCollection GetByOblastId(int a)
        {
            model.LearnByPracticeDataContext context = CreateContext();
            DataLoadOptions options = new DataLoadOptions();

            options.LoadWith <model.Tehnologija>(tehnologija => tehnologija.Oblast);
            context.LoadOptions = options;
            var tehnologii = from t in context.Tehnologijas
                             where t.Oblast_ID == a
                             select t;

            domain.TehnologijaCollection result = new domain.TehnologijaCollection();
            foreach (model.Tehnologija teh in tehnologii)
            {
                domain.Tehnologija domainObject = new domain.Tehnologija();
                domainObject.Id        = teh.ID;
                domainObject.Ime       = teh.Ime;
                domainObject.oblast.Id = teh.Oblast_ID;
                if (teh.Oblast != null)
                {
                    domainObject.oblast.Id  = teh.Oblast.ID;
                    domainObject.oblast.Ime = teh.Oblast.Ime;
                }
                result.Add(domainObject);
            }
            return(result);
        }
예제 #2
0
        public domain.TehnologijaCollection GetAll()
        {
            model.LearnByPracticeDataContext context = CreateContext();
            DataLoadOptions options = new DataLoadOptions();

            options.LoadWith <model.Tehnologija>(tehnologija => tehnologija.Oblast);
            context.LoadOptions = options;
            IQueryable <model.Tehnologija> query = context.Tehnologijas;

            domain.TehnologijaCollection result = new domain.TehnologijaCollection();
            foreach (model.Tehnologija modelObject in query)
            {
                domain.Tehnologija domainObject = new domain.Tehnologija();
                domainObject.Id        = modelObject.ID;
                domainObject.Ime       = modelObject.Ime;
                domainObject.oblast.Id = modelObject.Oblast_ID;
                if (modelObject.Oblast != null)
                {
                    domainObject.oblast.Id  = modelObject.Oblast.ID;
                    domainObject.oblast.Ime = modelObject.Oblast.Ime;
                }
                result.Add(domainObject);
            }

            return(result);
        }
예제 #3
0
 /// <summary>Конструктор на класата <c>Oblast</c>, со параметри.</summary>
 /// <param name="t">објект од класата <c>TehnologijaCollection</c></param>
 public Oblast(TehnologijaCollection t)
 {
     Tehnologii = t;
 }