public async Task <IActionResult> Post([FromBody] Channel channel) { var model = _mapper.Map <Channel, Contract.DTO.Chat.Channel>(channel); TryAsync <Unit> svcResult = async() => await _chatService.AddChannel(model); var result = svcResult.Match <Unit, IActionResult>( Succ: unit => NoContent(), Fail: ex => StatusCode(500, ex) ); return(await result); }
public void Post([FromBody] Channel channel) { var model = _mapper.Map <Channel, Contract.DTO.Chat.Channel>(channel); _chatService.AddChannel(model); }