static MongoDataContext() { ProductMapping.Register(); MachineMapping.Register(); ProjectMapping.Register(); AddressMapping.Register(); }
public async Task <IEnumerable <OutMachineDTO> > GetMachinesOfMachineTypeByMachineTypeIdAsync(int machineTypeId) { Expression <Func <Machine, bool> > withMachineType = m => m.MachineType.Id.Equals(machineTypeId); var machines = await _machineRepository.GetWhere(withMachineType, 0, 100); return(MachineMapping.MachineToOutDto(machines)); }
public async Task <OutMachineDTO> CreatMachineAsync(InMachineDTO machineDto) { var newMachine = MachineMapping.InDtoToMachine(machineDto); newMachine.MachineType = await _machineTypeRepository.GetById(machineDto.MachineType); var machine = await _machineRepository.Create(newMachine); var outMachineDto = MachineMapping.MachineToOutDto(machine); return(outMachineDto); }
public async Task <OutMachineDTO> UpdateMachineAsync(int id, InMachineDTO machineDto) { var machine = await _machineRepository.GetById(id); if (machine != null) { Machine machineMapping = MachineMapping.InDtoToMachine(machineDto); machine.Description = machineMapping.Description; machine.MachineName = machineMapping.MachineName; var machineType = await _machineTypeRepository.GetById(machineDto.MachineType); machine.MachineType = machineType; machine.Active = machineMapping.Active; } var createdMachine = await _machineRepository.Update(machine); var outMachineDto = MachineMapping.MachineToOutDto(createdMachine); return(outMachineDto); }
public Task <BoolResult> ForceRegisterMachineAsync(OperationContext context, MachineMapping mapping) { throw new NotImplementedException($"Attempt to use {nameof(ClientGlobalCacheStore)} for machine registration is unsupported"); }
public async Task <IEnumerable <OutMachineDTO> > GetMachines(int @from, int take) { var machines = await _machineRepository.GetAll(from, take); return(MachineMapping.MachineToOutDto(machines)); }
public async Task <OutMachineDTO> GetByNameAsync(string name) { var machine = await _machineRepository.GetByName(name); return(MachineMapping.MachineToOutDto(machine)); }
public async Task <OutMachineDTO> GetByIdAsync(int id) { var machine = await _machineRepository.GetById(id); return(MachineMapping.MachineToOutDto(machine)); }