Exemplo n.º 1
0
 public void Create(CreateContentTypeRequest request)
 {
     this.ValidateCreateRequest(request);
     using (IUnitOfWork uow = new UnitOfWork(RepositoryType.MSSQL))
     {
         IContentTypeRepository repo        = IoC.Container.Resolve <IContentTypeRepository>(uow);
         ContentType            contentType = new ContentType(request.Name, request.Key, request.Description);
         this.UpdateParameters(contentType.Id, request.Parameters, uow);
         repo.Add(contentType);
         uow.Commit();
     }
 }
 public void Create(CreateContentTypeRequest request)
 {
     ValidateCreateRequest(request);
     using (IUnitOfWork uow = new UnitOfWork(new AppDbContext(IOMode.Write)))
     {
         IContentTypeRepository repo        = IoC.Container.Resolve <IContentTypeRepository>(uow);
         ContentType            contentType = new ContentType(request.Name, request.Key, request.Description);
         UpdateParameters(contentType.Id, request.Parameters, uow);
         repo.Add(contentType);
         uow.Commit();
     }
 }
 public void CreateIfNotExist(IList <CreateContentTypeRequest> request)
 {
     using (IUnitOfWork uow = new UnitOfWork(new AppDbContext(IOMode.Write)))
     {
         IContentTypeRepository repo = IoC.Container.Resolve <IContentTypeRepository>(uow);
         foreach (CreateContentTypeRequest item in request)
         {
             if (repo.GetByKey(item.Key) != null)
             {
                 continue;
             }
             ContentType contentType = new ContentType(item.Name, item.Key, item.Description);
             repo.Add(contentType);
         }
         uow.Commit();
     }
 }
Exemplo n.º 4
0
        public ContentType AddContentType(ContentType contentType)
        {
            IContentTypeRepository contentTypeRepository = _dataFactoryRepository.GetDataRepository <IContentTypeRepository>();

            return(contentTypeRepository.Add(contentType));
        }