public async Task <IEnumerable <Device> > ImportByModelAsync(DeviceImportModel importModel) { foreach (var device in importModel.Devices) { await devicesRepository.AddAsync(device); } await devicesRepository.CommitAsync(); return(importModel.Devices); }
public async Task <IActionResult> Create([Bind("Id,Name,GroupId,Type,ModelId,IsMonitoring")] Device device, List <string> InterfacesNames, List <string> InterfacesAddresses) { if (ModelState.IsValid) { device.Interfaces = _helper.GetInterfacesFromNameAddress(InterfacesNames, InterfacesAddresses); await _devicesRepository.AddAsync(device); return(RedirectToAction(nameof(Index))); } DeviceVM.Groups = await _groupsRepository.GetAll().ToListAsync(); return(View(device)); }