public async Task <ActionResult <ConsumableViewResource> > PostAction([FromServices] IPost post, [FromBody] ConsumableViewResource consume) { HeaderDecode.DecodeHeader(Request); log.LogInformation($"Adding {consume.Name} to consumable resources"); return(await TryTask <ConsumableViewResource> .Run(async() => { await post.AddConsumable(consume); return consume; })); }
/// <summary> /// adds a consumable resource to the database /// </summary> /// <param name="input">input</param> /// <returns>updated item after adding</returns> public async Task AddConsumable(ConsumableViewResource item) { item.Id = (await input.Add(item.ToData())).Id; }