示例#1
0
        public async Task <ActionResult> NewOrExistingNotification(NewOrExistingNotificationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.GenerateNew.Value)
            {
                var response = await mediator.SendAsync(
                    new CreateNotificationApplication
                {
                    CompetentAuthority = model.CompetentAuthority,
                    NotificationType   = model.NotificationType
                });

                return(RedirectToAction("Created", "NewNotification",
                                        new
                {
                    area = string.Empty,
                    id = response
                }));
            }

            TempData[SelectedCompetentAuthority] = model.CompetentAuthority;
            TempData[SelectedNotificationType]   = model.NotificationType;

            return(RedirectToAction("EnterNumber"));
        }
        public async Task<ActionResult> NewOrExistingNotification(NewOrExistingNotificationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            if (model.GenerateNew.Value)
            {
                var response = await mediator.SendAsync(
                    new CreateNotificationApplication
                    {
                        CompetentAuthority = model.CompetentAuthority,
                        NotificationType = model.NotificationType
                    });

                return RedirectToAction("Created", "NewNotification",
                    new
                    {
                        area = string.Empty,
                        id = response
                    });
            }

            TempData[SelectedCompetentAuthority] = model.CompetentAuthority;
            TempData[SelectedNotificationType] = model.NotificationType;

            return RedirectToAction("EnterNumber");
        }