public static async System.Threading.Tasks.Task <HostDto> CreateHostAsync(HostForCreationDto host) { Host newHost = new Host { Name = host.Name, TwitterHandle = host.TwitterHandle }; _context.Hosts.Add(newHost); await _context.SaveChangesAsync(); return(new HostDto { Id = newHost.Id, Name = newHost.Name, TwitterHandle = newHost.TwitterHandle }); }
public async Task <ActionResult <HostDto> > CreateHost([FromBody] HostForCreationDto host) { var returnHost = await HostLogic.CreateHostAsync(host); return(CreatedAtAction("GetHost", new { id = returnHost.Id }, returnHost)); }