public ActionResult DeleteConfirmed(int id) { Amiibo amiibo = db.Amiiboes.Find(id); db.Amiiboes.Remove(amiibo); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
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)); }
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); }
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(); } } }
// 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(); } } }
private AmiiboTag(ArraySegment <byte> internalTag) { this.InternalTag = internalTag; this.Amiibo = Amiibo.FromInternalTag(internalTag); this.AmiiboSettings = new AmiiboSettings(CryptoBuffer, AppData); }
private AmiiboTag(byte[] internalTag) { this.InternalTag = internalTag; this.Amiibo = Amiibo.FromInternalTag(internalTag); this.AmiiboSettings = AmiiboSettings.FromCryptoBuffer(CryptoBuffer); }