コード例 #1
0
        public async Task AddEducator(CreateTenantEducatorDto input)
        {
            var isExist = await _tenantEducatorRepository.GetAll()
                          .Where(x => x.EducatorId == input.EducatorId && x.TenantId == input.TenantId).ToListAsync();

            if (isExist.Count != 0)
            {
                throw new Exception("Bu egitmen zaten ekli!");
            }
            var tenant = await _tenantRepository.GetByIdAsync(input.TenantId);

            var model = new TenantEducator
            {
                EducatorId = input.EducatorId,
                TenantId   = input.TenantId
            };
            await _tenantEducatorRepository.AddAsync(model);

            await _notificationAppService.CreateNotify(new CreateNotificationDto
            {
                OwnerId           = input.EducatorId,
                OwnerType         = EntityType.Educator,
                SenderId          = input.TenantId,
                SenderType        = EntityType.Tenant,
                Title             = "Ekleme isteği",
                Content           = tenant.TenantName + " " + "sizi eğitmen olarak eklemek istiyor.",
                NotifyContentType = NotifyContentType.SubscribeRequest
            });
        }
コード例 #2
0
        public async Task HandleSubscribeTenant(SubscribeDto input)
        {
            var relation = await _tenantEducatorRepository.GetAll()
                           .FirstOrDefaultAsync(x => x.EducatorId == input.EducatorId && x.TenantId == input.TenantId);

            relation.IsAccepted = input.IsAccepted;
            await _tenantEducatorRepository.UpdateAsync(relation);

            var educator = await _educatorRepository.GetByIdAsync(input.EducatorId);

            if (input.IsAccepted)
            {
                await _notificationAppService.CreateNotify(new CreateNotificationDto
                {
                    OwnerId    = input.TenantId,
                    OwnerType  = EntityType.Tenant,
                    SenderId   = input.TenantId,
                    SenderType = EntityType.Educator,
                    Content    =
                        educator.Profession + " " + educator.Name + " " + educator.Surname + " " + "Eğitmen Ekleme Talebinizi Kabul Etti.",
                    NotifyContentType = NotifyContentType.SubscribeResponse
                });
            }
        }
コード例 #3
0
        public async Task <IActionResult> CreateNotify(CreateNotificationDto input)
        {
            await _notificationAppService.CreateNotify(input);

            return(Ok());
        }