Ejemplo n.º 1
0
        private async Task <ScheduleDefViewModel> BindSelectLists(ScheduleDefViewModel model)
        {
            model
            .SetWeekDaySelectList(await scheduleJobService.GetScheduleWeekDays())
            .SetTimezoneSelectList(UserTimezone)
            .SetLogins(UserFacebookCredentials ?? await appUserService.FacebookCredentials(UserId))
            .SetFriends(UserFacebookFriends ?? await appUserService.FacebookFriends(UserId));

            return(model);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Update(ScheduleDefViewModel model)
        {
            if (ModelState.IsValid && model.Id > 0)
            {
                try
                {
                    await scheduleJobService.UpdateScheduleJobDef(model.ToScheduleJobDef(UserId));

                    SetSuccessNotification("Schedule {0} updated successfully", model.Id);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
            }
            return(View(await BindSelectLists(model)));
        }