public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } var materialToModify = await _context.WarehouseItems .Include(m => m.BuyMeasureUnit) .Include(m => m.Company) .Include(m => m.FpaDef) .Include(m => m.MainMeasureUnit) .Include(m => m.MaterialCaterory) .Include(p => p.CompanyMappings) .Include(m => m.SecondaryMeasureUnit).FirstOrDefaultAsync(m => m.Id == id); if (materialToModify == null) { return(NotFound()); } ItemVm = _mapper.Map <WarehouseItemModifyDto>(materialToModify); int[] selectedCompanies = materialToModify.CompanyMappings.Select(x => x.CompanyId).ToArray(); ItemVm.SelectedCompanies = JsonSerializer.Serialize(selectedCompanies); LoadCombos(); // _toastNotification.AddInfoToastMessage("Welcome to edit page"); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } var materialToModify = await _context.WarehouseItems .Include(m => m.BuyMeasureUnit) .Include(m => m.Company) .Include(m => m.FpaDef) .Include(m => m.MainMeasureUnit) .Include(m => m.MaterialCaterory) .Include(m => m.SecondaryMeasureUnit).FirstOrDefaultAsync(m => m.Id == id); if (materialToModify == null) { return(NotFound()); } WarehouseItemVm = _mapper.Map <WarehouseItemModifyDto>(materialToModify); LoadCombos(); // _toastNotification.AddInfoToastMessage("Welcome to edit page"); return(Page()); }