// DELETE: api/Livro/5 public void Delete(long model) { using (IConnection connection = new ConnectionFactory()) { connection.Open(); IDao <Book> dao = new BookDao(connection); dao.Delete(model); //if (!dao.Delete(model)) new Exception("Livro não encontrado!"); } }
public override void UpgradeToTargetVersion(IConnection connection) { var dao = new BookDao(TargetVersion.GetType()); dao.CurrentConnection = connection; dao.CreateTableIfNotExists(); ++ModifiedCount; dao.CreateIndexIfNotExists(); ++ModifiedCount; if (dao.CountAll() > 0) { dao.Delete(new Dictionary <string, object>()); ++ModifiedCount; } dao.UpgradeTable(new VersionChangeUnit(typeof(VersionOrigin), TargetVersion.GetType())); ++ModifiedCount; }
public ActionResult Delete(int id) { try { BookDao bookDao = new BookDao(); Book book = bookDao.GetbyId(id); System.IO.File.Delete(Server.MapPath("~/Uploads/Book/") + book.ImageName); bookDao.Delete(book); TempData["scs"] = "Kniha " + book.Name + " byla smazána"; } catch (Exception e) { throw; } return(RedirectToAction("Index", "Books")); }
public void delete(decimal usu) { BookDao e = new BookDao(); e.Delete(usu); }
public ActionResult DeleteBook(int id) { try { BookDao bookDao = new BookDao(); Book book = bookDao.GetById(id); if ( book.ImageName != null ) System.IO.File.Delete(Server.MapPath("~/image/articleImage/" + book.ImageName)); bookDao.Delete(book); TempData["message-success"] = "Článek" + book.Title + "byla smazan."; } catch ( Exception exception ) { throw; } return RedirectToAction("Index"); }
public static bool Delete(BookDto dto) { allNotDeletedBooks.Remove(dto); return(BookDao.Delete(dto.BookId)); }