protected IActionResult Delete <T>(long id, string success = null)
            where T : class, IHaveID
        {
            IBaseEntityService <T> service = this.Services.OfType <IBaseEntityService <T> >().First();

            return(this.ResponseServiceFunction <T, long>(service.Delete, id));
        }
        protected IActionResult AddOrUpdate <T>(T value, string success = null)
            where T : class, IHaveID
        {
            IBaseEntityService <T> service = this.Services.OfType <IBaseEntityService <T> >().First();

            return(this.ResponseServiceFunction <T, T>(service.AddOrUpdate, value));
        }
        protected IActionResult GetAll <T>(string success = null)
            where T : class, IHaveID
        {
            IBaseEntityService <T> service = this.Services.OfType <IBaseEntityService <T> >().First();

            return(this.ResponseServiceFunction(service.FindAll));
        }
Ejemplo n.º 4
0
 public ExamsController(IBaseEntityService <Examination> baseEntityService, IExamService examService, ProducerConfig producerConfig, IBaseRepository <Contest> contestRepo, IMapper mapper)
 {
     _examService       = examService;
     _producerConfig    = producerConfig;
     _contestRepo       = contestRepo;
     _mapper            = mapper;
     _baseEntityService = baseEntityService;
 }
 public IntegrationsController(IUserService userService, IBaseEntityService <Contest> baseContestService, IBaseEntityService <Transcript> baseTranscriptService, IBaseRepository <Transcript> baseTranscriptRepo, IMapper mapper, IBaseEntityService <User> baseUserService)
 {
     _uri = new Uri("http://api.toedu.me");
     _baseContestService    = baseContestService;
     _baseTranscriptService = baseTranscriptService;
     _baseTranscriptRepo    = baseTranscriptRepo;
     _mapper          = mapper;
     _baseUserService = baseUserService;
 }
Ejemplo n.º 6
0
        public static T GetBySeName <T>(this IBaseEntityService <T> entityService, string seName) where T : BaseEntity
        {
            //resolve permalink service
            var permalinkService = mobSocialEngine.ActiveEngine.Resolve <IPermalinkService>();
            var entityname       = typeof(T).Name;
            var permalink        = permalinkService.FirstOrDefault(x => x.EntityName == entityname && x.Slug == seName && x.Active);

            if (permalink == null)
            {
                return(default(T));
            }

            var entityId = permalink.EntityId;

            return(entityService.Get(entityId));
        }
Ejemplo n.º 7
0
        public static async Task <T> GetBySeNameAsync <T>(this IBaseEntityService <T> entityService, string seName) where T : BaseEntity
        {
            //resolve permalink service
            var permalinkService = EngineContext.Current.Resolve <IUrlRecordService>();
            var entityname       = typeof(T).Name;
            var permalink        = await permalinkService.FirstOrDefaultAsync(x => x.EntityName == entityname && x.Slug == seName && x.IsActive);

            if (permalink == null)
            {
                return(default(T));
            }

            var entityId = permalink.EntityId;

            return(await entityService.GetAsync(entityId));
        }
Ejemplo n.º 8
0
 public OptionController(IBaseEntityService <Option> optionService)
 {
     this.optionService = optionService;
 }
 public UpdateEntityCommandHandler(IBaseEntityService <TEntity> baseService)
 {
     this.baseService = baseService;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Khởi tạo service chung
 /// </summary>
 /// <param name="baseEntityService"></param>
 /// CreateBy: NVMANH (20/04/2020)
 public BaseEntityController(IBaseEntityService <T> baseEntityService)
 {
     _baseEntityService = baseEntityService;
 }
Ejemplo n.º 11
0
 public TestController(IBaseEntityService <Brand> brandService)
 {
     _brandService = brandService;
 }
Ejemplo n.º 12
0
 public TermsController(IBaseEntityService <Term> baseEntityService, ITermService termService, IContestService contestService)
 {
     _termService       = termService;
     _baseEntityService = baseEntityService;
 }
Ejemplo n.º 13
0
 public CategoriesController(IBaseEntityService <Category> service)
 {
     this.Services.Add(service);
 }
Ejemplo n.º 14
0
 public BaseApiController(IBaseEntityService <TEntity, TEntityDto> baseEntityService,
                          IValidatorFactory validationFactory)
 {
     _baseEntityService = baseEntityService;
     _validationFactory = validationFactory;
 }
 public GenericQueryWithProjectCommandHandler(IBaseEntityService <TEntity> baseService)
 {
     this.baseService = baseService;
 }
        public void SetUp()
        {
            _mockRepository = new MockRepository();
            _repository = _mockRepository.DynamicMock<IRepository<BaseEntity>>();

            _service = new BaseEntityService<BaseEntity>(_repository);
        }
 public CampaignAppService(IBaseEntityService <Campaign> service)
 {
     _campaignService = service;
 }
Ejemplo n.º 18
0
 public UsersController(IBaseEntityService <User> baseEntityService) : base(baseEntityService)
 {
 }
Ejemplo n.º 19
0
 public ContestsController(IBaseEntityService <Contest> baseEntityService, IContestService contestService)
 {
     _contestService    = contestService;
     _baseEntityService = baseEntityService;
 }