Example #1
0
        public async Task <IActionResult> GetMachines(string q, CancellationToken ct)
        {
            var list = await _service.GetAsync(q, ct);

            if (list == null)
            {
                return(NotFound());
            }
            return(Ok(list));
        }
Example #2
0
        public async Task <IActionResult> Edit([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var machine = await _machineService.GetAsync(id);

            if (machine == null)
            {
                return(NotFound());
            }

            var machineViewModel = _mapper.Map <MachineEditViewModel>(machine);

            machineViewModel.MachineTypeList = CreateMachineTypeList();
            machineViewModel.StorageList     = CreateStorageList();

            return(View(machineViewModel));
        }