public Phrase SavePhrase(Phrase phrase)
 {
     using (var db = new RevolutionEntities1())
       {
     db.Phrases.Add(phrase);
     db.SaveChanges();
     return phrase;
       }
 }
 public void RemoveCharacter(int id)
 {
     using (var db = new RevolutionEntities1())
       {
     var character = db.Characters.FirstOrDefault(c => c.ID == id);
     if (character == null) return;
     character.Deleted = true;
     db.SaveChanges();
       }
 }
 public void RemovePhrase(int id)
 {
     using (var db = new RevolutionEntities1())
       {
     var phrase = db.Phrases.FirstOrDefault(c => c.ID == id);
     if (phrase == null) return;
     db.Phrases.Remove(phrase);
     db.SaveChanges();
       }
 }
        public Character SaveCharacter(Character character)
        {
            using (var db = new RevolutionEntities1())
            {
                Character ch = db.Characters.Where(c => c.ID == character.ID).FirstOrDefault();

                if (ch != default(Character))
                {
                    db.Entry(ch).CurrentValues.SetValues(character);
                }
                else
                {
                    db.Characters.Add(character);
                }
                db.SaveChanges();
                return character;
            }
        }