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