public async Task <IActionResult> AddUsedProjectItemToProject(List <ItemViewModel> items) { try { var projectItems = items.Where(x => x.Amount > 0).Select(x => new ProjectUsedItemViewModel() { Amount = x.Amount, Price = x.Price, ProjectId = x.projectID, ItemId = x.Id, }); await _itemService.AddUsedItemAsync(ProjectUsedItemMapper.Map(projectItems).ToList()).ConfigureAwait(false); return(RedirectToAction("Details", "Project", new { id = items[0].projectID })); } catch (Exception) { ErrorViewModel model = new ErrorViewModel { RequestId = "Kunne ikke indberette nogle Matrialer" }; return(View("Error", model)); } }