Ejemplo n.º 1
0
 public IActionResult ManageAlien(string id)
 {
     model         = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     ViewBag.Alien = model.GetRegdAlien(id);
     if (ViewBag.Alien.Rows.Count > 0)
     {
         ViewBag.Type = "regd";
     }
     else
     {
         ViewBag.Alien = model.GetUnregdAlien(id);
         if (ViewBag.Alien.Rows.Count > 0)
         {
             ViewBag.Type = "unregd";
         }
         else
         {
             ViewBag.Type = null;
         }
     }
     ViewBag.DangerDegrees = model.GetDangerDegrees();
     ViewBag.Races         = model.GetRaces();
     ViewBag.Planets       = model.GetPlanets();
     ViewBag.Race          = model.GetRace(ViewBag.Alien.Rows[0]["race"].ToString());
     return(View());
 }
Ejemplo n.º 2
0
 public IActionResult ManageAlienProperties(string id)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     ViewBag.HasProperties    = model.GetAlienHasProperties(id);
     ViewBag.NotHasProperties = model.GetAlienNotHasProperties(id);
     ViewBag.Alienkey         = id;
     return(View());
 }
Ejemplo n.º 3
0
 public IActionResult ManageAlienConnections(string id)
 {
     model                   = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     ViewBag.HasShips        = model.GetAlienHasShips(id);
     ViewBag.NotHasShips     = model.GetAlienNotHasShips(id);
     ViewBag.HasWeapons      = model.GetAlienHasWeapons(id);
     ViewBag.NotHasWeapons   = model.GetAlienNotHasWeapons(id);
     ViewBag.HasIncidents    = model.GetAlienHasIncidents(id);
     ViewBag.NotHasIncidents = model.GetAlienNotHasIncidents(id);
     ViewBag.Alienkey        = id;
     return(View());
 }
Ejemplo n.º 4
0
 public IActionResult AddAlien(string alienkey, string regdssn, string name, string danger, string race, string planet, string type)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     if (type == "regd")
     {
         model.AddAlien(alienkey, regdssn, name, danger, race, planet, "true");
     }
     else
     {
         model.AddAlien(alienkey, null, name, danger, race, null, "false");
     }
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 5
0
 public IActionResult AlienPropertiesAction(string alienkey, string propertykey, string newproperty, string activity)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     if (activity == "Connect")
     {
         model.ConnectProperty(alienkey, propertykey);
     }
     else if (activity == "Add")
     {
         model.AddProperty(newproperty);
     }
     return(RedirectToAction("ManageAlienProperties", new { @id = alienkey }));
 }
Ejemplo n.º 6
0
 public IActionResult AlienAction(string alienkey, string name, string danger, string race, string planet, string type, string activity, string command, string newregdssn)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     if (activity == "Update")
     {
         model.UpdateAlien(alienkey, name, danger, race, planet, type);
     }
     else if (activity == "Delete")
     {
         string message = model.DeleteAlien(alienkey, command);
         if (message == "success")
         {
             return(RedirectToAction("Index"));
         }
     }
     else if (activity == "Register")
     {
         model.RegisterAlien(alienkey, newregdssn);
     }
     return(RedirectToAction("ManageAlien", new { @id = alienkey }));
 }
Ejemplo n.º 7
0
 public IActionResult Index(string search, string filter)
 {
     if (HttpContext.Session.GetString("dbusername") == null || HttpContext.Session.GetString("dbusername") == "guest")
     {
         return(RedirectToAction("Index", "Home"));
     }
     model  = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     search = search ?? "";
     if (search == "" && filter == null)
     {
         ViewBag.RegdAliens   = model.GetRegdAliens();
         ViewBag.UnregdAliens = model.GetUnregdAliens();
     }
     else
     {
         ViewBag.Search = search;
         ViewBag.Filter = filter;
         if (filter == "regd")
         {
             ViewBag.RegdAliens = model.GetRegdSearch("%" + search + "%");
         }
         else if (filter == "unregd")
         {
             ViewBag.UnregdAliens = model.GetUnregdSearch("%" + search + "%");
         }
         else if (filter == "all")
         {
             ViewBag.RegdAliens   = model.GetRegdSearch("%" + search + "%");
             ViewBag.UnregdAliens = model.GetUnregdSearch("%" + search + "%");
         }
     }
     ViewBag.DangerDegrees = model.GetDangerDegrees();
     ViewBag.Races         = model.GetRaces();
     ViewBag.Planets       = model.GetPlanets();
     return(View());
 }
Ejemplo n.º 8
0
 public async Task PostAlienInformation(AlienModel AlienDetectorModel)
 {
     await this.AlienModelTable.InsertAsync(AlienDetectorModel);
 }
Ejemplo n.º 9
0
 public IActionResult DeleteIncidentConnection(string alienkey, string incidentkey)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     model.DisconnectIncident(alienkey, incidentkey);
     return(RedirectToAction("ManageAlienConnections", new { @id = alienkey }));
 }
Ejemplo n.º 10
0
 public IActionResult AddWeaponConnection(string alienkey, string weaponkey)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     model.ConnectWeapon(alienkey, weaponkey);
     return(RedirectToAction("ManageAlienConnections", new { @id = alienkey }));
 }
Ejemplo n.º 11
0
 public IActionResult DeletePropertyConnection(string alienkey, string propertykey)
 {
     model = new AlienModel(HttpContext.Session.GetString("dbusername"), HttpContext.Session.GetString("dbpassword"));
     model.DisconnectProperty(alienkey, propertykey);
     return(RedirectToAction("ManageAlienProperties", new { @id = alienkey }));
 }