如何在没有登录的情况下将项目添加到购物车并在mvc4中登录 [英] How to add items to cart without login and with login in mvc4

查看:64
本文介绍了如何在没有登录的情况下将项目添加到购物车并在mvc4中登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用mvc4现在我需要在没有用户登录的情况下将项目添加到购物车,并且一旦用户登录网站,所有以前添加到网站的项目如何使用此方案?

Hi I am working with mvc4 now I need to add items to cart without user login and once the user logged into the site all the previous items that are added to the site how to work with this scenario?

推荐答案

您需要具备一些独特性才能知道哪个用户正在访问该站点。可能在添加到购物车之前只是询问他的用户名,如果已注册。因为虽然您将保存到数据库中,并且当用户假设今天将项目添加到购物车并返回并明天登录时,我们需要显示添加的项目!因此,您需要添加项目以及一些独特的属性来区分用户。

我希望你理解。

请回复你的疑问。

谢谢
You need to have some uniqueness to know which user is accessing the site. May be before adding to cart just ask for his username if registered. Because while you will save into the database and when the user suppose adds items to cart today and come back and logs in tomorrow, we need to show the added items right!! So for that you need to add items along with some unique property to distinguish the user.
I hope you understand.
Please post back your queries if any.
Thanks


这篇关于如何在没有登录的情况下将项目添加到购物车并在mvc4中登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆