Esempio n. 1
0
        public static ServiceRota MapToModel(ServiceRotaCreateMessageRequest request)
        {
            if (request == null)
            {
                return(new ServiceRota());
            }

            return(new ServiceRota
            {
                Authorization = Guid.NewGuid().ToString(),
                Rota = request.Rota,
                Active = true
            });
        }
        public async Task <HttpResult <ServiceRotaMessageResponse> > Create(ServiceRotaCreateMessageRequest request)
        {
            var retorno = new HttpResult <ServiceRotaMessageResponse>();

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

            var retornoTaskCreate = ServiceRotaServiceTask.Create(MapToModelServiceRota.MapToModel(request));

            retorno.Response = MapToResponseServiceRotaMessage.MapToServiceRotaMessageResponse(retornoTaskCreate.Response);
            retorno.Message  = retornoTaskCreate.Message;

            return(retorno);
        }
 public async Task <HttpResult <ServiceRotaMessageResponse> > Create([FromBody] ServiceRotaCreateMessageRequest request)
 {
     return(await ServiceRotaAppService.Create(request));
 }