Exemple #1
0
        public HomeModule()
        {
            Get["/form"] = _ => {
                return(View["form.cshtml"]);
            };
            Get["/parcelDisplay"] = _ => {
                string   parcelName   = Request.Query["parcel-name"];
                string   parcelHeight = Request.Query["parcel-height"];
                string   parcelWidth  = Request.Query["parcel-width"];
                string   parcelLength = Request.Query["parcel-length"];
                string   parcelWeight = Request.Query["parcel-weight"];
                string[] formValues   = { parcelName, parcelHeight, parcelWidth, parcelLength, parcelWeight };

                if (Array.Exists(formValues, element => element == ""))
                {
                    return(View["form.cshtml"]);
                }
                else
                {
                    ParcelObject userParcel = new ParcelObject(parcelName, int.Parse(parcelWeight), int.Parse(parcelHeight), int.Parse(parcelWidth), int.Parse(parcelLength));

                    return(View["parcel-display.cshtml", userParcel]);
                }
            };
        }
Exemple #2
0
        public ActionResult Index()
        {
            ParcelObject newParcel = new ParcelObject(Request.Query["length"], Request.Query["width"], Request.Query["height"], Request.Query["weight"]);

            newParcel.Save();

            return(View(ParcelObject.GetAll()));
        }
        public ActionResult Price(int weight, int height, int width, int length)
        {
            ParcelObject myParcel = new ParcelObject(weight, height, width, length);

            myParcel.GetVolume();
            myParcel.VolumePrice();
            myParcel.WeightPrice();
            myParcel.TotalPrice();
            return(View(myParcel));
        }