public async Task <IActionResult> EditNotification(int id) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManagePushNotification)) { return(AccessDeniedView()); } var pushNotification = await _pushNotificationService.GetPushNotificationByIdAsync(id); if (pushNotification == null) { return(RedirectToAction("Index")); } var model = await _pushNotificationModelFactory.PreparePushNotificationModel(null, pushNotification); model.StockTakeList = GetStockTakeStore(null); model = GetRepeat(model); model.SelectedRepeat = pushNotification.Interval; model.StartTime = pushNotification.StartTime != null ? pushNotification.StartTime.Value : DateTime.Now; model.EndTime = pushNotification.EndTime != null ? pushNotification.EndTime.Value : DateTime.Now; model.AvailableStockTakeList = model.StockTakeList.Select(stList => new SelectListItem { Text = stList.StockTakeNo, Value = stList.StockTakeNo }).ToList(); if (model.StockTakeNo != 0) { model.SelectedStockTake = new List <int?>(); model.SelectedStockTake.Add(model.StockTakeNo); } return(View(model)); }