public static OathViewModel ToViewModel(this Oath oath) { return(new OathViewModel { Name = oath.Name, Description = oath.Description, Mods = oath.Mods.Select(sm => sm.ToViewModel()).ToList(), OathId = oath.Id, Author = oath.Player?.ToViewModel() }); }
// POST: api/Oath public async Task <Oath> Post([FromBody] PostRequest request) { var service = new OathService(); var txhash = await service.Write(request.OathContent); Oath oath = new Oath(); oath.OathContent = request.OathContent; oath.TxHash = txhash; return(oath); }