public void A_CreateCategory()
        {
            Category category = new Category("testName");

            IRepository<Category> categoryRep = new CategoryRepository();
            categoryRep.Create(category);
        }
Ejemplo n.º 2
0
 public Article(string titleHr, string titleEng, string contentHr, string contentEng, string summaryHr, string summaryEng, string youTubeCode, bool publicContent, bool onEnglish, bool hasVideo, Category category, Author author, List<Photo> photos)
 {
     TitleHr = titleHr;
     TitleEng = titleEng;
     ContentHr = contentHr;
     ContentEng = contentEng;
     SummaryHr = summaryHr;
     SummaryEng = summaryEng;
     YouTubeCode = youTubeCode;
     PublicContent = publicContent;
     OnEnglish = onEnglish;
     HasVideo = hasVideo;
     Category = category;
     Author = author;
     CreationDate = DateTime.Now;
     Photos = photos;
 }
Ejemplo n.º 3
0
 public void Delete(Category entity)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 session.Delete(entity);
                 transaction.Commit();
             }
             catch (ADOException)
             {
                 throw new Exception("Defined category doesn't exist");
             }
         }
     }
 }
Ejemplo n.º 4
0
 public void Update(Category entity)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             try
             {
                 session.Update(entity);
                 transaction.Commit();
             }
             catch (ADOException)
             {
                 throw new Exception("Unable to update category");
             }
         }
     }
 }
Ejemplo n.º 5
0
 public void Create(Category entity)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             try
             {
                 session.Save(entity);
                 transaction.Commit();
             }
             catch (NHibernate.ADOException)
             {
                 throw new Exception("Defined category already exists");
             }
         }
     }
 }