public ActionResult DeleteConfirmed(int id) { Marki marki = db.Markis.Find(id); db.Markis.Remove(marki); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdMarki,NazwaMarki")] Marki marki) { if (ModelState.IsValid) { db.Entry(marki).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(marki)); }
public ActionResult Create([Bind(Include = "IdMarki,NazwaMarki")] Marki marki) { if (ModelState.IsValid) { db.Markis.Add(marki); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(marki)); }
// GET: Marki/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Marki marki = db.Markis.Find(id); if (marki == null) { return(HttpNotFound()); } return(View(marki)); }
public static ITelefon StworzObiektTelefon(Marki marki) { ITelefon telefon = null; switch (marki) { case Marki.Apple: telefon = new Apple(); break; case Marki.Samsung: telefon = new Samsung(); break; default: throw new ArgumentOutOfRangeException("marki", "Błędna marka."); } return(telefon); }
public static ITelefon CreateTelefonObject(Marki markaTyp) { ITelefon telefon = null; switch (markaTyp) { case Marki.Apple: telefon = new Apple(); break; case Marki.Samsung: telefon = new Samsung(); break; default: throw new ArgumentOutOfRangeException("markaTyp", "Nieznana marka telefonu."); } return(telefon); }