public static void SeedDatabase(IApplicationBuilder app) { using (var serviceScope = app.ApplicationServices.CreateScope()) { ICharacterRepositoryAdapter adapter = serviceScope.ServiceProvider.GetService <ICharacterRepositoryAdapter>(); using (StreamReader r = new StreamReader("briv.json")) { string json = r.ReadToEnd(); Character character = JsonConvert.DeserializeObject <Character>(json); DomainCharacter initialChar = CharacterConverter.ToDomain(character); adapter.SaveCharacter(initialChar); } } }
public ActionResult <DomainCharacter> AddDomainCharacter([FromBody] DomainCharacter characterToAdd) { return(repositoryAdapter.SaveCharacter(characterToAdd)); }