Esempio n. 1
0
 public HomeModule()
 {
     Get["/"] = _ => {
         return(View["index.cshtml"]);
     };
     Post["/"] = _ => {
         string     userInput     = Request.Form["name"];
         Nutcracker newNutcracker = new Nutcracker(userInput);
         newNutcracker.Save();
         string            newName        = newNutcracker.GetName();
         List <Nutcracker> allNutcrackers = Nutcracker.GetAll();
         return(View["index.cshtml", allNutcrackers]);
     };
 }
Esempio n. 2
0
 public override bool Equals(System.Object otherNutcracker)
 {
     if (!(otherNutcracker is Nutcracker))
     {
         return(false);
     }
     else
     {
         Nutcracker newNutcracker = (Nutcracker)otherNutcracker;
         bool       idEquality    = (this.GetId() == newNutcracker.GetId());
         bool       nameEquality  = (this.GetName() == newNutcracker.GetName());
         return(idEquality && nameEquality);
     }
 }