Esempio n. 1
0
        public void AddPhone(PhoneDTO dto)
        {
            Phone phone = new Phone()
            {
                clientID = dto.clientID,
                brand    = dto.brand,
                type     = dto.type,
                IMEI     = dto.IMEI
            };

            DbContext.Phones.Add(phone);
            DbContext.SaveChanges();
        }
Esempio n. 2
0
        public void UpdatePhone(int id, PhoneDTO phone)
        {
            var tel = DbContext.Phones.SingleOrDefault(b => b.phoneID == id);

            System.Diagnostics.Debug.WriteLine("In PhoneServices - UpdatePhone(); id -> " + id + " phone.phoneID -> " + phone.phoneID);

            if (tel != null)
            {
                tel.brand = phone.brand;
                tel.type  = phone.type;
                tel.IMEI  = phone.IMEI;

                DbContext.SaveChanges();
            }
        }