예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Amiibo amiibo = db.Amiiboes.Find(id);

            db.Amiiboes.Remove(amiibo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "PK,AmiiboSeries,Character,GameSeries,Head,Image,Name,ReleaseAU,ReleaseEU,ReleaseJP,ReleaseNA,Tail,Type")] Amiibo amiibo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(amiibo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(amiibo));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "PK,AmiiboSeries,Character,GameSeries,Head,Image,Name,ReleaseAU,ReleaseEU,ReleaseJP,ReleaseNA,Tail,Type")] Amiibo amiibo)
        {
            if (ModelState.IsValid)
            {
                db.Amiiboes.Add(amiibo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(amiibo));
        }
예제 #4
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Amiibo amiibo = db.Amiiboes.Find(id);

            if (amiibo == null)
            {
                return(HttpNotFound());
            }
            return(View(amiibo));
        }
예제 #5
0
        public async Task <int> CreateAmiiboAsync(AddAmiiboInputModel model)
        {
            var amiibo = new Amiibo
            {
                Name           = model.Name,
                Description    = model.Description,
                ImgUrl         = model.ImgUrl,
                ReleaseDate    = model.ReleaseDate,
                Franchise      = model.Franchise,
                AmiiboSeriesId = model.AmiiboSeriesId,
                PriceUrl       = model.PriceUrl,
            };

            await this.amiiboRepository.AddAsync(amiibo);

            await this.amiiboRepository.SaveChangesAsync();

            return(amiibo.Id);
        }
예제 #6
0
        public void RemoveFromWishList(int amiiboID)
        {
            if (!ControllerContext.IsChildAction)
            {
                var    userID      = db.AspNetUsers.FirstOrDefault(x => x.Email == System.Web.HttpContext.Current.User.Identity.Name).Id;
                Amiibo amiibo2Save = db.Amiiboes.FirstOrDefault(y => y.PK == amiiboID);

                var sameRecord = db.AmiiboUserBridges.Any(x => x.IsWishList == true && x.UserID == userID && x.AmiiboID == amiibo2Save.PK);

                if (sameRecord == true)
                {
                    var sameRecord2 = db.AmiiboUserBridges.Where(x => x.IsWishList == true && x.UserID == userID && x.AmiiboID == amiibo2Save.PK).FirstOrDefault();

                    db.AmiiboUserBridges.Remove(sameRecord2);

                    db.SaveChanges();
                }
            }
        }
예제 #7
0
        // GET: AmiiboUserBridge

        public void AddToWishList(int amiiboID)
        {
            if (!ControllerContext.IsChildAction)
            {
                var    userID      = db.AspNetUsers.FirstOrDefault(x => x.Email == System.Web.HttpContext.Current.User.Identity.Name).Id;
                Amiibo amiibo2Save = db.Amiiboes.FirstOrDefault(y => y.PK == amiiboID);

                var sameRecord = db.AmiiboUserBridges.Any(x => x.IsWishList == true && x.UserID == userID && x.AmiiboID == amiibo2Save.PK);

                if (sameRecord == false)
                {
                    bridgeTable.AmiiboID = amiibo2Save.PK;
                    bridgeTable.UserID   = userID;

                    bridgeTable.IsWishList = true;

                    db.AmiiboUserBridges.Add(bridgeTable);

                    db.SaveChanges();
                }
            }
        }
예제 #8
0
 private AmiiboTag(ArraySegment <byte> internalTag)
 {
     this.InternalTag    = internalTag;
     this.Amiibo         = Amiibo.FromInternalTag(internalTag);
     this.AmiiboSettings = new AmiiboSettings(CryptoBuffer, AppData);
 }
예제 #9
0
 private AmiiboTag(byte[] internalTag)
 {
     this.InternalTag    = internalTag;
     this.Amiibo         = Amiibo.FromInternalTag(internalTag);
     this.AmiiboSettings = AmiiboSettings.FromCryptoBuffer(CryptoBuffer);
 }