Ejemplo n.º 1
0
        public async Task <ActionResult> VerifyBidder(string key, AuctionAppModel model)
        {
            var auction = await _auctionContext.GetByKeyAsync(key);

            if (null == auction)
            {
                return(this.NotFound($"{key} not found!"));
            }
            if (!this.IsBidder(model.BidderEmail, model.BidderCode, auction.Bidders))
            {
                return(this.Forbidden($"{model.BidderEmail} not verified!"));
            }

            var bidderNickname = this.GetBidder(model.BidderEmail, model.BidderCode, auction.Bidders).Nickname;

            dynamic jObject = new JObject();

            jObject.Key      = key;
            jObject.Auth     = true;
            jObject.Nickname = bidderNickname;
            return(this.Ok((string)JsonConvert.SerializeObject(jObject).ToString()));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Put(string key, Auction auction)
        {
            var existing = await _auctionContext.GetByKeyAsync(key);

            if (null == existing)
            {
                return(this.NotFound($"{key} not found!"));
            }

            Auction result;

            if (this.IsAdministrator())
            {
                result = await _adminAuctionQuery.Put(key, auction);
            }
            else
            {
                result = await _userAuctionQuery.Put(key, auction);
            }
            return(null != result
                ? this.Ok(JsonConvert.SerializeObject(new FirebaseObject <Auction>(key, auction)))
                : this.InternalServerError(string.Empty));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> Dashboard()
        {
            ViewBag.Message         = "The dashboard page.";
            ViewBag.IsAdministrator = this.IsAdministrator();

            var key = ((ClaimsIdentity)HttpContext.User.Identity).Claims
                      .Where(c => c.Type == ClaimTypes.NameIdentifier)
                      .Select(c => c.Value)
                      .First();

            var admin = await _userContext.GetByKeyAsync(key);

            return(View(new FirebaseObject <User>(key, admin)));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Get(string key)
        {
            var result = await _userContext.GetByKeyAsync(key);

            return(null != result?this.Ok(JsonConvert.SerializeObject(result)) : this.NotFound($"{key} not found!"));
        }