public virtual async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);
            var        client     = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            IPostTypeService service = testServer.Host.Services.GetService(typeof(IPostTypeService)) as IPostTypeService;
            var model = new ApiPostTypeServerRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiPostTypeServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.PostTypeDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiPostTypeServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Exemplo n.º 2
0
        //private readonly ILogger logger;

        public EArchiveController(IHttpContextAccessor accessor,
                                  IMapper mapper,
                                  IMailArchiveService mailArchiveService,
                                  IWorkPlaceService workPlaceService,
                                  IClassificationService classificationService,
                                  IMailTypeService mailTypeService,
                                  IPostTypeService postTypeService,
                                  ISecurityService securityService,
                                  IStatusService statusService,
                                  IImageArchiveService imageArchiveService,
                                  IUserService userService
                                  //ILogger logger
                                  ) : base(accessor, userService)
        {
            this.accessor              = accessor;
            this.mapper                = mapper;
            this.mailArchiveService    = mailArchiveService;
            this.workPlaceService      = workPlaceService;
            this.classificationService = classificationService;
            this.mailTypeService       = mailTypeService;
            this.postTypeService       = postTypeService;
            this.securityService       = securityService;
            this.statusService         = statusService;
            this.imageArchiveService   = imageArchiveService;
            //this.logger = logger;
        }
Exemplo n.º 3
0
 public HomeController(ILayoutService layoutService,
                       IClientHomeService clientHomeService,
                       IPostService postService,
                       IDetailUserTypeService detailUser,
                       IHaveSendQuestionService haveSendQuesService,
                       IPostTypeService postTypeService,
                       ICommentService commentOfPost,
                       IPostVoteDetailService postVoteDetailService,
                       IDetailUserTypeService detailUserType,
                       ICommentVoteDetailService commentVoteDetailService,
                       IToiecGroupService fbService,
                       IEventService eventService
                       )
     : base(layoutService)
 {
     _clientHomeService        = clientHomeService;
     _postService              = postService;
     _detailUserTypeService    = detailUser;
     _haveSendQuesService      = haveSendQuesService;
     _postTypeService          = postTypeService;
     _commentOfPost            = commentOfPost;
     _postVoteDetailService    = postVoteDetailService;
     _detailUserType           = detailUserType;
     _commentVoteDetailService = commentVoteDetailService;
     _fbService    = fbService;
     _eventService = eventService;
     initChatBotMenu();
 }
Exemplo n.º 4
0
 public PostController(IPostService PostSvc, IPostTypeService TypeSvc, IPostStatusService StatuSvc, IPostCommontService CommentSvc)
 {
     this.PostSvc    = PostSvc;
     this.TypeSvc    = TypeSvc;
     this.StatuSvc   = StatuSvc;
     this.CommentSvc = CommentSvc;
 }
        public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiPostTypeServerModelMapper();
            ApplicationDbContext           context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            IPostTypeService               service = testServer.Host.Services.GetService(typeof(IPostTypeService)) as IPostTypeService;
            ApiPostTypeServerResponseModel model   = await service.Get(1);

            ApiPostTypeClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties("B");

            UpdateResponse <ApiPostTypeClientResponseModel> updateResponse = await client.PostTypeUpdateAsync(model.Id, request);

            context.Entry(context.Set <PostType>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <PostType>().ToList()[0].RwType.Should().Be("B");

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.RwType.Should().Be("B");
        }
Exemplo n.º 6
0
		public AbstractPostTypeController(
			ApiSettings settings,
			ILogger<AbstractPostTypeController> logger,
			ITransactionCoordinator transactionCoordinator,
			IPostTypeService postTypeService,
			IApiPostTypeModelMapper postTypeModelMapper
			)
			: base(settings, logger, transactionCoordinator)
		{
			this.PostTypeService = postTypeService;
			this.PostTypeModelMapper = postTypeModelMapper;
		}
Exemplo n.º 7
0
        public CategoryViewModelProvider(
            LanguageViewModelProvider languageViewModelProvider,
            ICategoryService categoryService,
            IPostTypeService postTypeService
            )
        {
            languageViewModelProvider.CheckArgumentIsNull();
            _languageViewModelProvider = languageViewModelProvider;

            categoryService.CheckArgumentIsNull();
            _categoryService = categoryService;

            postTypeService.CheckArgumentIsNull();
            _postTypeService = postTypeService;
        }
Exemplo n.º 8
0
 public PostTypeController(
     ApiSettings settings,
     ILogger <PostTypeController> logger,
     ITransactionCoordinator transactionCoordinator,
     IPostTypeService postTypeService,
     IApiPostTypeServerModelMapper postTypeModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.PostTypeService     = postTypeService;
     this.PostTypeModelMapper = postTypeModelMapper;
     this.BulkInsertLimit     = 250;
     this.MaxLimit            = 1000;
     this.DefaultLimit        = 250;
 }
Exemplo n.º 9
0
 public ArchiveController(IHttpContextAccessor accessor,
                          IMapper mapper,
                          IClassificationService classification,
                          IMailTypeService mailType,
                          IPostTypeService postType,
                          ISecurityService security,
                          IStatusService status,
                          IUserService userService) : base(accessor, userService)
 {
     this.mapper         = mapper;
     this.classification = classification;
     this.mailType       = mailType;
     this.postType       = postType;
     this.security       = security;
     this.status         = status;
     this.userService    = userService;
 }
Exemplo n.º 10
0
 public ProfileController(ILayoutService layoutService,
                          IClientProfileService clientProfileService,
                          IPostService postService,
                          IPostTypeService postTypeService,
                          IPostVoteDetailService postVoteDetailService,
                          ICommentService commentOfPost,
                          ICommentVoteDetailService commentVoteDetailService,
                          IClientFriendService friendService
                          )
     : base(layoutService)
 {
     _clientProfileService     = clientProfileService;
     _postService              = postService;
     _postTypeService          = postTypeService;
     _postVoteDetailService    = postVoteDetailService;
     _commentOfPost            = commentOfPost;
     _commentVoteDetailService = commentVoteDetailService;
     _friendService            = friendService;
 }
Exemplo n.º 11
0
 public PostController(ILayoutService layoutService,
                       IPostService postService,
                       IPostTypeService postTypeService,
                       IPostVoteDetailService postVoteDetailService,
                       ICommentService commentOfPost,
                       ICommentVoteDetailService commentVoteDetailService,
                       IClientNotificationService notificationService,
                       IDetailUserTypeService detailUserTypeService,
                       IToiecGroupService fbService,
                       IEventService eventService)
     : base(layoutService)
 {
     _postService              = postService;
     _postTypeService          = postTypeService;
     _postVoteDetailService    = postVoteDetailService;
     _commentOfPost            = commentOfPost;
     _commentVoteDetailService = commentVoteDetailService;
     _detailUserTypeService    = detailUserTypeService;
     _notificationService      = notificationService;
     _fbService    = fbService;
     _eventService = eventService;
 }
Exemplo n.º 12
0
        public CategoryController(
            CategoryViewModelProvider viewModelProvider,
            ICategoryService categoryService,
            LanguageViewModelProvider languageProvider,
            IPostTypeService postTypeService,
            ILanguageService languageService
            )
        {
            viewModelProvider.CheckArgumentIsNull();
            _viewModelProvider = viewModelProvider;

            categoryService.CheckArgumentIsNull();
            _categoryService = categoryService;

            languageProvider.CheckArgumentIsNull();
            _languageProvider = languageProvider;

            postTypeService.CheckArgumentIsNull();
            _postTypeService = postTypeService;

            languageService.CheckArgumentIsNull();
            _languageService = languageService;
        }
Exemplo n.º 13
0
        public PostViewModelProvider(
            LanguageViewModelProvider languageProvider,
            IPostTypeService postTypeService,
            IPostService postService,
            CategoryViewModelProvider categoryProvider,
            ITagService tagService
            )
        {
            postTypeService.CheckArgumentIsNull();
            _postTypeService = postTypeService;

            languageProvider.CheckArgumentIsNull();
            _languageViewModelProvider = languageProvider;

            postService.CheckArgumentIsNull();
            _postService = postService;

            categoryProvider.CheckArgumentIsNull();
            _categoryProvider = categoryProvider;

            tagService.CheckArgumentIsNull(nameof(tagService));
            _tagService = tagService;
        }
 public PostTypeController(IPostTypeService postTypeSvc)
 {
     PostTypeSvc = postTypeSvc;
 }
Exemplo n.º 15
0
 public PostTypeController(IPostTypeService service)
 {
     _service = service;
 }
 public AdminPostTypeController(IPostTypeService postTypeService, ILayoutAdminService layoutService)
     : base(postTypeService, layoutService)
 {
     _postTypeService = postTypeService;
 }
 public static void Delete(this IPostTypeService service, PostType model)
 {
     service.DeleteAsync(model).GetAwaiter().GetResult();
 }
 public static void Delete(this IPostTypeService service, string id)
 {
     service.DeleteAsync(id).GetAwaiter().GetResult();
 }
 public static PostType GetById(this IPostTypeService service, string id)
 {
     return(service.GetByIdAsync(id).GetAwaiter().GetResult());
 }
 public static IEnumerable <PostType> GetAll(this IPostTypeService service)
 {
     return(service.GetAllAsync().GetAwaiter().GetResult());
 }
Exemplo n.º 21
0
 public PostTypeController(IPostTypeService postTypeService)
 {
     _postTypeService = postTypeService;
 }