Ejemplo n.º 1
0
 public IActionResult AddShow(NewShowViewModel viewModel)
 {
     if (HttpContext.Session.GetInt32("InSession") != null)
     {
         if (ModelState.IsValid)
         {
             Show newShow = viewModel.newShow;
             newShow.Host = dbContext.Users
                            .FirstOrDefault(u => u.UserId == HttpContext.Session.GetInt32("InSession"));
             dbContext.Add(newShow);
             dbContext.SaveChanges();
             return(RedirectToAction("Dashboard"));
         }
         return(View("Create"));
     }
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 2
0
        private void OpenNewShow(object sender, EventArgs e)
        {
            _showViewModel                     = new NewShowViewModel(_service);
            _showViewModel.Canceled           += (o, args) => { OpenMenu(_showWindow); };
            _showViewModel.MessageApplication += ViewModel_MessageApplication;
            _showViewModel.Success            += (o, args) =>
            {
                OpenMenu(_showWindow);
                ShowMsgBox("Successfully added");
            };

            _showWindow = new NewShowWindow {
                DataContext = _showViewModel
            };

            _showWindow.Show();
            _menuWindow.Close();
        }