Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] Job entity)
        {
            var filterRequestModel = new FilterRequestModel
            {
                CityId      = entity.CityId.ToString(),
                CategoryId  = entity.CategoryId.ToString(),
                EducationId = entity.EducationId.ToString(),
                Salary      = entity.SalaryMin
            };

            var result = await _jobService.Add(entity);

            if (result != Guid.Empty)
            {
                var currJob = await _jobService.GetById(result.ToString());

                var users = await _filterService.GetUsers(filterRequestModel);

                if (users.Count() > 0)
                {
                    foreach (var user in users)
                    {
                        //await _mailService.SendMailAsync(user.Username, user.Email, "aue");
                        await _notifyService.RefreshNotification(currJob, entity.RecruiterId.ToString());

                        //await _smsService.SendMailAsync(user.Number, "aue");
                    }
                }
            }

            return(Ok(result));
        }