public IActionResult Delete(long id, ProductDeletionModel model = null) { long itemCount = _workshopRepository.GetTotalMaterialsCountInProduct(id); if (model == null) { model = new ProductDeletionModel(); } model.Pages = (itemCount / model.Items) + 1; if (model.Page > model.Pages) { model.Page = model.Pages; } model.Materials = _workshopRepository.GetMaterialsUsedInProductPaged(id, (int)model.Page, (int)model.Items); model.Product = _workshopRepository.GetProduct(id); return(View(model)); }