Ejemplo n.º 1
0
        public HttpResult <ServiceRotaToggle> Create(ServiceRotaToggle serviceRotaToggle, int toggleId)
        {
            var retorno = new HttpResult <ServiceRotaToggle>();

            var retornoToggleGet = ToggleEntityService.Get(toggleId);

            if (retornoToggleGet == null)
            {
                return(retorno.SetHttpStatusToNotFound());
            }

            serviceRotaToggle.Toggle = retornoToggleGet.Result;

            _dbContext.Context.ServiceRotaToggle.Add(serviceRotaToggle);

            _dbContext.SaveChanges();

            retorno.Response = serviceRotaToggle;
            retorno.SetHttpStatusToCreated();

            return(retorno);
        }
Ejemplo n.º 2
0
 private HttpResult <ServiceRotaToggle> CreateServiceRotaToggle(ServiceRotaToggle serviceRotaToggle, int toggleId)
 {
     return(taskServiceRota.Create(serviceRotaToggle, toggleId));
 }
Ejemplo n.º 3
0
        public static ServiceRotaToggleMessageResponse MapToServiceRotaToggleMessageResponse(ServiceRotaToggle serviceRotaToggle)
        {
            if (serviceRotaToggle == null)
            {
                return(new ServiceRotaToggleMessageResponse());
            }

            return(new ServiceRotaToggleMessageResponse
            {
                Id = serviceRotaToggle.Id,
                Rota = serviceRotaToggle.Rota,
                ToggleId = serviceRotaToggle.Toggle.Id,
                Active = serviceRotaToggle.Active
            });
        }