public SaveCharacterDTO Add(SaveCharacterDTO obj) { Character characterToSave = new Character(); characterToSave.Name = obj.Name; Context.Character.Add(characterToSave); Context.SaveChanges(); obj.Id = characterToSave.Id; return(obj); }
public void Update(SaveCharacterDTO obj) { Character characterToSave = Context.Character.FirstOrDefault(c => c.Id == obj.Id); if (characterToSave != null) { characterToSave.Name = obj.Name; Context.SaveChanges(); } }
public JsonResult Update(SaveCharacterDTO character) { CharacterRepository.Update(character); return(new JsonResult(true)); }
public JsonResult Add(SaveCharacterDTO character) { var res = CharacterRepository.Add(character); return(new JsonResult(res)); }