コード例 #1
0
        // GET: AuctionRoom
        public ActionResult Index(int id)
        {
            if (User.Identity.IsAuthenticated)
            {
                try
                {
                    List <AuctionRegistration> reglys = APIMethods.APIGetALL <List <AuctionRegistration> >("AuctionRegistrations");

                    Property model = APIMethods.APIGet <Property>(id.ToString(), "Properties");


                    foreach (AuctionRegistration reg in reglys)
                    {
                        if (model.PropertyID == reg.PropertyID && reg.BuyerId == User.Identity.GetUserId())
                        {
                            return(View(model));
                        }
                    }
                    return(RedirectToAction("RegisterForAuction", "Buyers", new { id = model.PropertyID }));
                }
                catch (Exception E)
                {
                    return(RedirectToAction("Create", "Buyers", new { id = 0 }));
                }
            }
            else
            {
                return(RedirectToAction("login", "account"));
            }
        }