示例#1
0
        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);
        }
示例#2
0
        public void Post([FromBody] Channel channel)
        {
            var model = _mapper.Map <Channel, Contract.DTO.Chat.Channel>(channel);

            _chatService.AddChannel(model);
        }