public async Task <IActionResult> AddShopcar(GoodRequest order) { string userName = HttpContext.Session.GetString("UserName"); int? userId = HttpContext.Session.GetInt32("UserId"); log.InfoFormat(userName + " || Get into 添加购物车商品"); try { order.UserId = userId; var or = await _orderManager.AddOrderAsync(order); var good = await _indexManager.GetAsync(order.GoodId); log.InfoFormat("获取商品详情成功" + (good != null ? Helper.JsonHelper.ToJson(good) : "")); log.InfoFormat("添加购物车商品成功" + (or != null ? Helper.JsonHelper.ToJson(or) : "")); ViewData["UserName"] = userName; return(View("../Index/Goodlistbranchdetails", good)); } catch (Exception e) { log.Error("添加购物车商品失败,错误提示: " + Helper.JsonHelper.ToJson(e)); return(View("Error", e)); } }