public async Task <ActionResult> ShowCart() { //从Cookie中获取用户的名字 Request.Cookies.TryGetValue("username", out string username); CartContext cartContext = HttpContext.RequestServices.GetService(typeof(dotNet期末项目.Models.CartContext)) as CartContext; return(Ok(await cartContext.Check(username))); }