public ActionResult Create(TenantScheduledJobViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var jobInfo = new JobInfoModel
                {
                    JobType        = "Scheduled",
                    CronExpression = vm.CronExpression,
                    Url            = vm.Url
                };

                var newScheduledJob = new TenantScheduledJob
                {
                    TenantId = vm.TenantId,
                    Name     = vm.Name,
                    JobInfo  = JsonConvert.SerializeObject(jobInfo)
                };

                db.TenantScheduledJobs.Add(newScheduledJob);
                db.SaveChanges();


                // Create Hangfire Job
                var selectedTenant = db.Tenants.FirstOrDefault(t => t.Id == vm.TenantId);
                if (selectedTenant != null)
                {
                    RecurringJob.AddOrUpdate(vm.Name, () => WebClientHelper.InvokeUrl(vm.Url), vm.CronExpression);
                }

                return(RedirectToAction("Details", "Tenants", new { id = vm.TenantId }));
            }

            return(View(vm));
        }
        public ActionResult Create(int tenantId)
        {
            var vm = new TenantScheduledJobViewModel
            {
                TenantId = tenantId
            };

            return(View(vm));
        }