Exemplo n.º 1
0
        public bool updateTelefon(int id, EditTelefonDto editTelefonDto)
        {
            bool succes = false;

            DAL.telefon t = DbContext.telefon.Find(id);
            if (t != null)
            {
                t.brand = editTelefonDto.Brand;
                t.marca = editTelefonDto.Marca;
                DbContext.SaveChanges();
                succes = true;
                return(succes);
            }


            return(succes);
        }
Exemplo n.º 2
0
        public Boolean delete(int id)
        {
            bool succes = false;


            DAL.telefon t = DbContext.telefon.Find(id);
            if (t != null)
            {
                DbContext.telefon.Remove(t);
                DbContext.SaveChanges();
                succes = true;
                return(succes);
            }


            return(succes);
        }
Exemplo n.º 3
0
        public String AddTelefon(AddTelefonDto addTelefonDto)
        {
            DAL.telefon em = new DAL.telefon();
            em.brand = addTelefonDto.Brand;
            em.marca = addTelefonDto.Marca;


            DAL.telefon em1 = DbContext.telefon.Where(n => n.brand == addTelefonDto.Brand && n.marca == addTelefonDto.Brand).SingleOrDefault();
            if (em == em1)
            {
                return("Deja exista");
            }


            DbContext.telefon.Add(em);
            DbContext.SaveChanges();
            return("adaugat");
        }