public ActionResult <OperationsDTO> GetOperationsByID(int id) { var operations = _IOperationsRepository.Select(id); OperationsDTO p = OperationsDTO.generateDto(operations); return(Ok(p)); }
public ActionResult PostMachineType(MachineTypeDTO machineTypeDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } List <Operations> list = new List <Operations>(); Operations novo = new Operations(); foreach (int item in machineTypeDTO.operations) { novo = _IOperationsRepository.Select(item); list.Add(novo); } MachineType machineType = new MachineType(new Designation(machineTypeDTO.designation), list); _IMachineTypeRepository.Insert(machineType); return(CreatedAtAction(nameof(GetMachineTypeById), new { id = machineType.Id }, machineType)); }