Exemplo n.º 1
0
        public ActionResult  ItemInCart()
        {
            var lstItems = new List <ItemInfo>();

            try
            {
                lstItems = ItemBL.ItemLoad(Convert.ToInt32(ItemStatus.InCart), CommonSystem.defaultBegin, CommonSystem.defaultEnd);
                SessionData.TotalRecord = CommonSystem.defaultEnd;
                SessionData.CurrentSession.TotalItemInCart = ItemBL.ItemInCartCount();
            }
            catch (Exception ex)
            {
            }
            return(View(lstItems));
        }
Exemplo n.º 2
0
        public ActionResult AddItem(decimal itemId)
        {
            try
            {
                var _obj = new ItemInfo();
                _obj.Item_Id = itemId;

                var MsgAlert = "";
                int p_return = 0;
                if (SessionData.CurrentSession.ListItemAdd.Contains(_obj.Item_Id))
                {
                    SessionData.CurrentSession.ListItemAdd.Remove(_obj.Item_Id);
                    _obj.IsInCart = Convert.ToInt32(ItemStatus.Normal);
                    p_return      = ItemBL.ItemUpdateInCart(_obj);
                    if (p_return >= Convert.ToInt32(CheckActionStatus.Succcess))
                    {
                        MsgAlert = MessageAlert.RemoveDone;
                        p_return = Convert.ToInt32(TypeAction.Remove);
                    }
                }
                else
                {
                    SessionData.CurrentSession.ListItemAdd.Add(_obj.Item_Id);
                    _obj.IsInCart = Convert.ToInt32(ItemStatus.InCart);
                    p_return      = ItemBL.ItemUpdateInCart(_obj);
                    if (p_return > Convert.ToInt32(CheckActionStatus.Succcess))
                    {
                        MsgAlert = MessageAlert.AddDone;
                        p_return = Convert.ToInt32(TypeAction.Add);
                    }
                    else
                    {
                        MsgAlert = MessageAlert.AddFail;
                    }
                }
                var countItemInCart = ItemBL.ItemInCartCount().ToString() + MessageAlert.CountItemInCart;
                return(Json(new { success = p_return, message = MsgAlert, countItem = countItemInCart }));
            }
            catch (Exception)
            {
                throw;
            }
        }