public HomeModule() { Get["/"] = _ => { return(View["parcel_form.html"]); }; Get["/parcel_cost"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables { width = Request.Query["width"], length = Request.Query["length"], height = Request.Query["height"], weight = Request.Query["weight"], distance = Request.Query["distance"], }; int newVolume = myParcelVariables.width * myParcelVariables.height * myParcelVariables.length; int newPrice = newVolume * myParcelVariables.weight * myParcelVariables.distance; ParcelReturn myParcelReturn = new ParcelReturn { volume = newVolume, price = newPrice, }; return(View["parcel_cost.html", myParcelReturn]); }; }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/price"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables(); int height; int width; int depth; int weight; // bool ifSuccess = int.TryParse(Request.Query["height"], out height); bool ifSuccess1 = int.TryParse(Request.Query["width"], out width); bool ifSuccess2 = int.TryParse(Request.Query["depth"], out depth); bool ifSuccess3 = int.TryParse(Request.Query["weight"], out weight); if (!int.TryParse(Request.Query["height"], out height) || !int.TryParse(Request.Query["width"], out width) || !int.TryParse(Request.Query["depth"], out depth) || !int.TryParse(Request.Query["weight"], out weight)) { return(View["error.cshtml"]); } else { int dimension = myParcelVariables.Volume(height, width, depth); int shippingCost = myParcelVariables.CalculateCost(weight, dimension); myParcelVariables.SetCost(shippingCost); return(View["price.cshtml", myParcelVariables]); } }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.html"]); }; Get["/parcel"] = _ => { int Length = 0; int.TryParse(Request.Query["Length"], out Length); int Width = 0; int.TryParse(Request.Query["Width"], out Width); int Height = 0; int.TryParse(Request.Query["Height"], out Height); int Weight = 0; int.TryParse(Request.Query["Weight"], out Weight); ParcelVariables parcel = new ParcelVariables(Length, Width, Height, Weight); if (Length > 0 && Width > 0 && Height > 0 && Weight > 0) { return(View["parcel.html", parcel]); } else { return(View["form.html", parcel]); } }; }
public ActionResult Results() { ParcelVariables myParcelVariable = new ParcelVariables(Int32.Parse(Request.Query["Length"]), Int32.Parse(Request.Query["Width"]), Int32.Parse(Request.Query["Height"]), Int32.Parse(Request.Query["Weight"])); Console.WriteLine(Int32.Parse(Request.Query["Length"])); return(View("results", myParcelVariable)); }
public ActionResult Receipt() { ParcelVariables myParcel = new ParcelVariables(); myParcel.SetDimensions(Request.Query["width"], Request.Query["height"]); return(View("Receipt", myParcel)); }
public HomeModule() { Get["/"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables(int.Parse(Request.Query["width"]), int.Parse(Request.Query["height"]), int.Parse(Request.Query["height"]), int.Parse(Request.Query["weight"])); return(View["index.cshtml", myParcelVariables]); }; Get["/form"] = _ => { return(View["form.cshtml"]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.cshtml"]); }; Get["/story"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables(); myParcelVariables.SetHeight(Request.Query["height"]); myParcelVariables.SetLength(Request.Query["length"]); myParcelVariables.SetWidth(Request.Query["width"]); myParcelVariables.SetWeight(Request.Query["weight"]); return(View["output.cshtml", myParcelVariables]); }; }
public HomeModule() { Get["/calculate"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables(); myParcelVariables.SetWidth(Request.Query["width"]); myParcelVariables.SetLength(Request.Query["length"]); myParcelVariables.SetHeight(Request.Query["height"]); myParcelVariables.SetWeight(Request.Query["weight"]); return(View["index.cshtml", myParcelVariables]); }; Get["/favorite_photos"] = _ => View["favorite_photos.cshtml"]; Get["/form"] = _ => { return(View["form.cshtml"]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.cshtml"]); }; Get["/parcel_display"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables { Length = Request.Query["length"], Width = Request.Query["width"], Height = Request.Query["height"], Weight = Request.Query["weight"], }; return(View["parcel.cshtml", myParcelVariables]); }; }
public HomeModules() { Get["/"] = _ => { return(View["form.html"]); }; Get["/results"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables { Width = Request.Query["width"], Length = Request.Query["length"], Height = Request.Query["height"], Weight = Request.Query["weight"] }; return(View["results.cshtml", myParcelVariables]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.html"]); }; Get["/parcels"] = _ => { ParcelVariables myParcelVariables = new ParcelVariables { Height = Request.Query["height"], Width = Request.Query["width"], Depth = Request.Query["depth"], Weight = Request.Query["weight"] }; myParcelVariables.SetVolume(); myParcelVariables.SetPrice(); return(View["parcels.html", myParcelVariables]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.cshtml"]); }; Get["/parcel"] = _ => { ParcelVariables newParcel = new ParcelVariables(); newParcel.SetLength(Request.Query["length"]); newParcel.SetWidth(Request.Query["width"]); newParcel.SetHeight(Request.Query["height"]); newParcel.SetWeight(Request.Query["weight"]); newParcel.SetVolume(); return(View["parcel.cshtml", newParcel]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.html"]); }; Get["/shipping"] = _ => { Parcel myParcel = new Parcel(Request.Query["Width"], Request.Query["Height"], Request.Query["Length"], Request.Query["Weight"]); ParcelVariables parcelVariables = new ParcelVariables { Width = myParcel.GetWidth(), Height = myParcel.GetHeight(), Length = myParcel.GetLength(), Weight = myParcel.GetWeight(), Volume = myParcel.Volume(), CostToShip = myParcel.CostToShip() }; return(View["shipping.html", parcelVariables]); }; }
public HomeModule() { Get["/form"] = _ => { return(View["form.cshtml"]); }; Get["/result"] = _ => { // int weight = (int)(Request.Query["weight"]); // int height = (int)(Request.Query["height"]); // int width = (int)(Request.Query["width"]); // int depth = (int)(Request.Query["depth"]); // if (weight>0 && height>0 && width>0 && depth>0) { ParcelVariables myParcelVariables = new ParcelVariables(Request.Query["weight"], Request.Query["height"], Request.Query["width"], Request.Query["depth"]); return(View["result.cshtml", myParcelVariables]); // } else { // return View["form_failure.cshtml","Invalid Input"]; // } }; }