Exemplo n.º 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
            });
        }
Exemplo n.º 2
0
        public async Task <IActionResult> RemoveEducator(CreateTenantEducatorDto input)
        {
            await _tenantAppService.RemoveEducator(input);

            return(Ok());
        }