public async Task <IActionResult> Edit(string id) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest()); } var entry = await _devices.GetFirstOrDefaultAsync(a => a.Id == id); if (entry == null) { return(NotFound()); } var model = _mapper.Map <DeviceViewModel>(entry); return(View("Form", model)); }