Example #1
0
        private IMemberUpsertJobAlertResponse GetUpsertResponse(JobAlertViewModel model, bool update = false)
        {
            JobAlertSalaryFilterReceiver salary = null;

            if (!model.SalaryStringify.IsNullOrEmpty())
            {
                salary = JsonConvert.DeserializeObject <JobAlertSalaryFilterReceiver>(model.SalaryStringify);
            }

            if (salary != null)
            {
                model.Salary = salary;
            }

            var epochTime = ConversionHelper.GetUnixTimestamp(SitefinityHelper.GetSitefinityApplicationTime(), true);

            model.LastModifiedTime = (long)epochTime;

            // Remove null value filters
            List <JobAlertFilters> Filters = new List <JobAlertFilters>();

            if (model != null && model.Filters != null && model.Filters.Count > 0)
            {
                foreach (var item in model.Filters)
                {
                    if (item.Values != null && item.Values.Count > 0)
                    {
                        Filters.Add(item);
                    }
                }
            }

            model.Filters = Filters;

            if (model != null && model.Email.IsNullOrEmpty())
            {
                model.Email = SitefinityHelper.GetLoggedInUserEmail();
            }

            var response = _jobAlertService.MemberJobAlertUpsert(model, update);

            return(response);
        }