Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Question about .netfiddle

at this site...
https://dotnetfiddle.net

select Project Type "Nancy"

I am not familiar with this structure:

      public class CustomerModule : NancyModule
      {
            public CustomerModule()
            {
                  // index is an entry point
                  Get["/index"] = parameters =>
                  {
                        var customers = GetCustomers();
                        return View[customers];
                  };
                  
                  Post["/add"] = parameters =>{
                        var customer = this.Bind<Customer>();

                        // lets validate it
                        var result = this.Validate<Customer>(customer);
                        if (!result.IsValid)
                        {
                              return RenderErrorView(result);
                        }

                        var customers = GetCustomers();
                        customers.Add(customer);
                        return View[customers];
                  };


Is this the non-MVC way of dealing with Get and Post? What would you call this paradigm?

Please explain the "/index" and "/add"

Thanks
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

thanks