Esempio n. 1
0
 public Partnior GetPartnior(string id)
 {
     if (id != null && id != String.Empty)
     {
         Partnior partnior = this.db.Partniors.Include(g => g.Galery).Include(gi => gi.Galery.GalleryImages).Include(i => i.Image).FirstOrDefault(x => x.Id == id);
         return(partnior);
     }
     else
     {
         Partnior partnior = this.db.Partniors.Include(g => g.Galery).Include(gi => gi.Galery.GalleryImages).Include(i => i.Image).FirstOrDefault();
         return(partnior);
     }
 }
Esempio n. 2
0
        public bool DeletePartnior(string id)
        {
            bool operatinOk = true;

            try
            {
                Partnior partnioroRemove = this.db.Partniors.FirstOrDefault(x => x.Id == id);
                this.db.Partniors.Remove(partnioroRemove);
                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + " --- PartniorsService Delete");
                operatinOk = false;
            }
            return(operatinOk);
        }
Esempio n. 3
0
        public bool AddPartnior(Partnior partnior)
        {
            bool operatinOk = true;

            try
            {
                this.db.Partniors.Add(partnior);

                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + " --- PartniorsService Add");
                operatinOk = false;
            }
            return(operatinOk);
        }
Esempio n. 4
0
        public bool EditPartnior(string id, Partnior partnior)
        {
            bool operatinOk = true;

            try
            {
                Partnior partniorToEdit = this.db.Partniors.FirstOrDefault(x => x.Id == id);
                partniorToEdit = partnior;

                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + " --- PartniorsService Edit");
                operatinOk = false;
            }
            return(operatinOk);
        }