我是编程的新手,我有一个按钮,当我点击它时,它会返回上一页.而不是返回上一页的按钮如何让该按钮打印当前信息?
这是我的PrintIndexViewModel类
using NavisionStore.Domain.Entities;
namespace NavisionStore.WebUI.Models
{
public class PrintIndexViewModel
{
public Print Print { get; set; }
public string ReturnUrl { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的打印控制器
namespace NavisionStore.WebUI.Controllers
{
public class PrintController : Controller
{
private IProductRepository repository;
public PrintController(IProductRepository repo)
{
repository = repo;
}
public ViewResult Index(string returnUrl)
{
return View(new PrintIndexViewModel
{
Print = GetPrint(),
ReturnUrl = returnUrl
});
}
public RedirectToRouteResult AddtoPrint(int id, string returnUrl)
{
Product product = repository.Products
.FirstOrDefault(p => p.Id == …Run Code Online (Sandbox Code Playgroud)