Beispiel #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);
        }
Beispiel #2
0
 private HttpResult <ServiceRotaToggle> CreateServiceRotaToggle(ServiceRotaToggle serviceRotaToggle, int toggleId)
 {
     return(taskServiceRota.Create(serviceRotaToggle, toggleId));
 }
Beispiel #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
            });
        }