예제 #1
0
        public void AddPhone(Phone phone)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                phone.PhoneId = 0;

                context.Phones.Add(phone);
                context.SaveChanges();
            }
        }
예제 #2
0
        public void AddNote(Note note)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                note.NoteId = 0;

                context.Notes.Add(note);
                context.SaveChanges();
            }
        }
예제 #3
0
        public void AddPhonesRange(IEnumerable<Phone> phoneList)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                foreach (var phone in phoneList)
                {
                    phone.PhoneId = 0;
                    context.Phones.Add(phone);
                }

                context.SaveChanges();
            }
        }
예제 #4
0
        public void AddNotesRange(IEnumerable<Note> noteList)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                foreach (var note in noteList)
                {
                    note.NoteId = 0;
                    context.Notes.Add(note);
                }

                context.SaveChanges();
            }
        }
예제 #5
0
        public void UpdatePhone(Phone phone)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                var curPhone = GetPhone(phone.PhoneId);

                curPhone.Name = phone.Name;
                curPhone.Number = phone.Number;

                context.SaveChanges();
            }
        }
예제 #6
0
        public void UpdateNote(Note note)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                var curNote = GetNote(note.NoteId);

                curNote.Text = note.Text;
                curNote.Moment = note.Moment;
                curNote.TargetComputer = note.TargetComputer;

                context.SaveChanges();
            }
        }
예제 #7
0
 public void SaveChanges()
 {
     using (var context = new UchOtdContext(ConnectionString))
     {
         context.SaveChanges();
     }
 }
예제 #8
0
        public void RemovePhone(int phoneId)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                var phone = context.Phones.FirstOrDefault(p => p.PhoneId == phoneId);

                context.Phones.Remove(phone);
                context.SaveChanges();
            }
        }
예제 #9
0
        public void RemoveNote(int noteId)
        {
            using (var context = new UchOtdContext(ConnectionString))
            {
                var note = context.Notes.FirstOrDefault(n => n.NoteId == noteId);

                context.Notes.Remove(note);
                context.SaveChanges();
            }
        }