Beispiel #1
0
        public INServices GetService(string id)
        {
            INServices service = new INServices();

            try{
                service = this.db.INServices.FirstOrDefault(x => x.Id == id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(service);
        }
Beispiel #2
0
        public bool AddINService(INServices service)
        {
            bool operationOk = true;

            try{
                this.db.INServices.Add(service);
                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                operationOk = false;
            }

            return(operationOk);
        }
Beispiel #3
0
        public bool DeleteINService(string id)
        {
            bool operationOk = true;

            try{
                INServices ins = this.db.INServices.FirstOrDefault(s => s.Id == id);
                this.db.INServices.Remove(ins);
                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                operationOk = false;
            }

            return(operationOk);
        }
Beispiel #4
0
        public bool EditINService(INServices newServices, string id)
        {
            bool operationOk = true;

            try{
                INServices oldService = this.db.INServices.FirstOrDefault(x => x.Id == id);
                oldService.Title       = newServices.Title;
                oldService.Description = newServices.Description;
                oldService.Link        = newServices.Link;
                oldService.Image       = newServices.Image;
                oldService.ImageId     = newServices.ImageId;

                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                operationOk = false;
            }
            return(operationOk);
        }