/// <summary> /// Updates the specified race. /// </summary> /// <param name="context">The context.</param> /// <param name="race">The race.</param> internal static void Update(DndDmHelperContext context, RaceDTO race) { var raceToUpdate = context.Races.Find(race.ID); raceToUpdate.Name = race.Name; context.Attach(raceToUpdate); context.Entry(raceToUpdate).State = EntityState.Modified; }
/// <summary> /// Edits the specified class. /// </summary> /// <param name="context">The context.</param> /// <param name="classDTO">The class dto.</param> internal static void Update(DndDmHelperContext context, ClassDTO classDTO) { var classToUpdate = context.Classes.Find(classDTO.ID); classToUpdate.Name = classDTO.Name; context.Attach(classToUpdate); context.Entry(classToUpdate).State = EntityState.Modified; }
/// <summary> /// Edits the specified note. /// </summary> /// <param name="context">The context.</param> /// <param name="noteDTO">The note dto.</param> internal static void Edit(DndDmHelperContext context, NoteDTO noteDTO) { var noteToEdit = context.Notes.Find(noteDTO.ID); noteToEdit.Name = noteDTO.Name; noteToEdit.Content = noteDTO.Content; noteToEdit.NoteTypeID = noteDTO.NoteTypeID; context.Attach(noteToEdit); context.Entry(noteToEdit).State = EntityState.Modified; }
/// <summary> /// Updates the specified character. /// </summary> /// <param name="characterDTO">The character to update.</param> /// <exception cref="System.NotImplementedException"></exception> internal static void Update(DndDmHelperContext context, CharacterDTO characterDTO) { var character = context.TemplateCharacters.Find(characterDTO.ID); character.Name = characterDTO.Name; character.Description = characterDTO.Description; character.Level = characterDTO.Level; character.ClassID = characterDTO.Class.ID; character.RaceID = characterDTO.Race.ID; context.Attach(character); context.Entry(character).State = EntityState.Modified; }