コード例 #1
0
 // 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!");
     }
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        public void delete(decimal usu)
        {
            BookDao e = new BookDao();

            e.Delete(usu);
        }
コード例 #5
0
ファイル: BookController.cs プロジェクト: PPRO/projectBlog
        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");
        }
コード例 #6
0
 public static bool Delete(BookDto dto)
 {
     allNotDeletedBooks.Remove(dto);
     return(BookDao.Delete(dto.BookId));
 }