public void AddComic(ComicDTO toAdd) { if (!CheckComic(toAdd)) { return; // launch exception } _comicDAO.InsertComic(toAdd); }
public ActionResult Create(ComicDTO comicDTO) { if (ModelState.IsValid) { bib = new Biblioteca(); bool annadirOk = bib.annadirComics(comicDTO); if (annadirOk == true) { return(RedirectToAction("Index")); } } return(View()); }
public ActionResult Edit(ComicDTO comicDTO) { if (ModelState.IsValid) { bib = new Biblioteca(); bool modificarOk = bib.modificarComic(comicDTO); if (modificarOk == true) { return(RedirectToAction("Index")); } } return(View(comicDTO)); }
private bool CheckComic(ComicDTO toCheck) { if (string.IsNullOrEmpty(toCheck.Series)) { return(false); } if (string.IsNullOrEmpty(toCheck.Title)) { return(false); } return(true); }
// GET: Comic/Edit/5 /* public ActionResult Edit(long? id) * { * if (id == null) * { * return new HttpStatusCodeResult(HttpStatusCode.BadRequest); * } * ObraCulturalBiblioteca obra = db.ObraCulturalBiblioteca.Find(id); * ComicBiblioteca comics = obra.ObraLiterariaBiblioteca.FirstOrDefault().ComicBiblioteca.FirstOrDefault(); * if (comics == null) * { * return HttpNotFound(); * } * ViewBag.IdObra= new SelectList(db.ObraCulturalBiblioteca, "IdObra", "TituloObra", comics.IdObra); * return View(comics); * }*/ public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bib = new Biblioteca(); ComicDTO comicDTO = bib.mostrarComics(id ?? 0); if (comicDTO == null) { return(HttpNotFound()); } return(View(comicDTO)); }
public void InsertComic(ComicDTO comic) { _db.Insert(comic); }