コード例 #1
0
ファイル: BetBusiness.cs プロジェクト: leumaskabiena/TradeApi
        public bool UpdateBet(UpdateBetModelView Updatemodel)
        {
            var    Itemrepo = new ItemService();
            string id       = Itemrepo.GetById(Updatemodel.id.Substring(Updatemodel.id.IndexOf('-') + 1)).ItemRef;

            using (var Betrepo = new BetService())
            {
                var model = Betrepo.GetById(Updatemodel.id);
                try
                {
                    model.IsAccept = Updatemodel.ans;
                    if (Updatemodel.ans == 2)
                    {
                        var item = Itemrepo.GetById(id);
                        item.status = "Sold";
                        Itemrepo.Update(item);
                    }
                    Betrepo.Update(model);
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
コード例 #2
0
        public ActionResult Decline(string id)
        {
            var item = new UpdateBetModelView
            {
                id  = id,
                ans = 1
            };

            if (_BetBusiness.UpdateBet(item))
            {
                return(RedirectToAction("MyNotUpdateBet"));
            }
            else
            {
                return(View());
            }
        }
コード例 #3
0
 public bool UpdateBet(UpdateBetModelView Updatemodel)
 {
     return(_BetBusiness.UpdateBet(Updatemodel));
 }