Beispiel #1
0
        public static Toggle MapToModel(ToggleCreateMessageRequest request)
        {
            if (request == null)
            {
                return(new Toggle());
            }

            return(new Toggle
            {
                Description = request.Description,
                Flag = request.Flag,
                Active = true
            });
        }
        public async Task <HttpResult <ToggleMessageResponse> > Create(ToggleCreateMessageRequest request)
        {
            var retorno = new HttpResult <ToggleMessageResponse>();

            if (request == null)
            {
                return(retorno.SetHttpStatusToBadRequest());
            }

            var retornoTaskCreate = ToggleServiceTask.Create(MapToModelToggle.MapToModel(request), request.IdsServiceRota);

            retorno.Response = MapToResponseToggleMessage.MapToToggleMessageResponse(retornoTaskCreate.Response);
            retorno.Message  = retornoTaskCreate.Message;

            return(retorno);
        }
 public async Task <HttpResult <ToggleMessageResponse> > Create([FromBody] ToggleCreateMessageRequest request)
 {
     return(await ToggleAppService.Create(request));
 }