public async Task <IActionResult> BundleCreate(BundlesDetailViewModel model) { var itemList = new List <int>(); if (!string.IsNullOrWhiteSpace(model.ItemsList)) { itemList = model.ItemsList .Split(',') .Where(_ => !string.IsNullOrWhiteSpace(_)) .Select(int.Parse) .ToList(); } if (ModelState.IsValid) { try { var bundle = await _avatarService.AddBundleAsync(model.Bundle, itemList); ShowAlertSuccess($"Bundle '<strong>{bundle.Name}</strong>' successfully created!"); return(RedirectToAction("Bundles")); } catch (GraException gex) { ShowAlertDanger("Unable to create bundle: ", gex); } } if (itemList.Count > 0) { model.Bundle.DynamicAvatarItems = await _avatarService.GetItemsByIdsAsync(itemList); foreach (var item in model.Bundle.DynamicAvatarItems) { item.Thumbnail = _pathResolver.ResolveContentPath(item.Thumbnail); } } model.Layers = new SelectList(await _avatarService.GetLayersAsync(), "Id", "Name"); PageTitle = "Create Bundle"; return(View("BundleDetail", model)); }