public ActionResult CardDetail() { string cardName=Request.QueryString["cardName"].ToString(); bizCard bc = new bizCard(); Card model = bc.Get(cardName); UserXCard modelUserCard = (new bizUserXCard()).Get(UserID, cardName); ViewData["User"] = (new bizUsers()).Get(UserID); ViewData["CardFusion"] = (new bizCardFusion()).List(cardName); ViewData["Num"] = modelUserCard == null ? 0 : modelUserCard.CardNum; ViewData["CardName"] = cardName; return View(model); }
public ActionResult BuyCard(FormCollection f) { bizUsers bu = new bizUsers(); bizCard bc = new bizCard(); bizUserXCard buc = new bizUserXCard(); Card cmodel = bc.Get(f["cardName"]); Users umodel = bu.Get(UserID); if (cmodel.AllowBuy != 1) return Content("�õ���������"); if (umodel.Jinbi < int.Parse(f["cardNum"]) * cmodel.Price) return Content("��İɱҲ�����������"); buc.BuyCard(UserID, f["cardName"], int.Parse(f["cardNum"])); return Content("�ɹ�������" + f["cardNum"] + "��"+cmodel.CardAlias); }
/// <summary> /// 新增Card /// </summary> /// <param name="userID"></param> /// <param name="cardName"></param> /// <param name="cardNum"></param> public void AddCard(int userID,string cardName, int cardNum) { UserXCard modelOld = Get(userID, cardName); bizCard bc = new bizCard(); Card modelCard = bc.Get(cardName); if (modelOld == null) { UserXCard model = new UserXCard(); model.UserID = userID; model.CardName = cardName; model.CardNum = cardNum; Add(model); } else { modelOld.Attach(); modelOld.CardNum += cardNum; modelOld.Detach(); Update(modelOld); } }
/// <summary> /// 新增Card /// </summary> /// <param name="userID"></param> /// <param name="cardName"></param> /// <param name="cardNum"></param> public void AddCard(int userID,string userName,string adminName, string cardName, int cardNum) { UserXCard modelOld = Get(userID, cardName); bizCard bc=new bizCard(); Card modelCard=bc.Get(cardName); if (modelOld == null) { UserXCard model = new UserXCard(); model.UserID = userID; model.CardName = cardName; model.CardNum = cardNum; Add(model); } else { modelOld.Attach(); modelOld.CardNum += cardNum; modelOld.Detach(); Update(modelOld); } (new bizAdminLog()).Add("为" + userName + "加上道具" + modelCard.CardAlias + cardNum.ToString() + "张", userName, adminName); string msg = "管理员 [b]" + adminName + "[/b] 为您加上道具[color=red]" + modelCard.CardAlias + cardNum.ToString() + "张[/color],并祝您在论坛中玩得开心。"; (new bizUserMsg()).AddSysMsg(userID, msg); }