public void ShowAll() { Character.ShowСharacteristics(ForCharacter, ForPet); Character.ShowСharacteristics(PersonLabel, PetsLabel); if (Character.Skin != null) { PersonPicture.BackgroundImage = Character.Skin; } else { PersonPicture.BackColor = Color.AliceBlue; } if (Character.pet != null) { try { ShopPet pet = (ShopPet)Character.pet; if (pet.Image != null) { PetsPicture.BackgroundImage = pet.Image; } else { PetsPicture.BackColor = Color.AliceBlue; } } catch (InvalidCastException) { PetsPicture.BackColor = Color.AliceBlue; } } }
public ActionResult DeleteConfirmed(string id) { ShopPet shopPet = db.ShopPets.Find(id); db.ShopPets.Remove(shopPet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IDPet,TenPet,LoaiPet,TuoiCuaPet")] ShopPet shopPet) { if (ModelState.IsValid) { db.Entry(shopPet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shopPet)); }
public ActionResult Create([Bind(Include = "IDPet,TenPet,LoaiPet,TuoiCuaPet")] ShopPet shopPet) { if (ModelState.IsValid) { db.ShopPets.Add(shopPet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shopPet)); }
// GET: ShopPets/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShopPet shopPet = db.ShopPets.Find(id); if (shopPet == null) { return(HttpNotFound()); } return(View(shopPet)); }