Exemplo n.º 1
0
 public IActionResult Login(string name)
 {
     if (String.IsNullOrEmpty(name))
     {
         string text = "";
         return(View("login", text));
     }
     if (!foxService.ListOfFoxes.Any(f => f.Name.Equals(name)))
     {
         Fox fox = new Fox(name);
         foxService.AddFoxToDatabase(fox);
         var text = $"A new fox with name {name} was added to the database.";
         return(View("login", text));
     }
     else
     {
         return(RedirectToAction("information", "Home", foxService.ListOfFoxes.Where(f => f.Name == name).ToList()[0]));
     }
 }