public ActionResult OnSubmit() { string length = Request.Query["length"]; string width = Request.Query["width"]; string height = Request.Query["height"]; string weight = Request.Query["weight"]; int num2; bool validLength = int.TryParse(length, out num2); bool validWidth = int.TryParse(width, out num2); bool validHeight = int.TryParse(height, out num2); bool validWeight = int.TryParse(weight, out num2); if (validLength == true && validWidth == true && validHeight == true && validWeight == true) { ParcelVariable myParcelVariable = new ParcelVariable(); myParcelVariable.SetLength(Request.Query["length"]); myParcelVariable.SetWidth(Request.Query["width"]); myParcelVariable.SetHeight(Request.Query["height"]); myParcelVariable.SetWeight(Request.Query["weight"]); return(View("Hello", myParcelVariable)); } else { Console.WriteLine("SORRY THIS DOESNT WORK"); return(View("Form")); } }
public ActionResult Output() { // string myHeightString = Request.Query["height"]; // int myHeight = int.Parse(myHeightString); // string myWeightString = Request.Query["weight"]; // int myWeight = int.Parse(myWeightString); // string myWidthString = Request.Query["width"]; // int myWidth = int.Parse(myWidthString); // string myLengthString = Request.Query["length"]; // int myLength = int.Parse(myLengthString); ParcelVariable newParcel = new ParcelVariable(); Console.WriteLine(Request.Query["height"]); if (Request.Query["height"] != "" && Request.Query["weight"] != "" && Request.Query["width"] != "" && Request.Query["length"] != "") { newParcel.SetHeight(int.Parse(Request.Query["height"])); newParcel.SetWeight(int.Parse(Request.Query["weight"])); newParcel.SetWidth(int.Parse(Request.Query["width"])); newParcel.SetLength(int.Parse(Request.Query["length"])); // Console.WriteLine(newParcel.GetHeight()); // Console.WriteLine(newParcel.GetWidth()); // Console.WriteLine(newParcel.GetLength()); // Console.WriteLine(newParcel.GetWeight()); return(View(newParcel)); } else { // MessageBox.Show("Please fill out all the boxes.", "Error message", MessageBoxButtons.OK, MessageBoxIcon.Error); string error = "Please fill out all the boxes."; return(View("Form", error)); } }
public ActionResult Result() { ParcelVariable myParcel = new ParcelVariable(); myParcel.SetParcel(Request.Query["Length"], Request.Query["Width"], Request.Query["Height"], Request.Query["Weight"]); return(View("Index", myParcel)); }
public ActionResult Parcel() { ParcelVariable myParcel = new ParcelVariable(); myParcel.SetParcel(Request.Query["length"], Request.Query["width"], Request.Query["height"], Request.Query["weight"]); return(View("index", myParcel)); }
public void Equals_ReturnsTrueIfPropertiesAreTheSame_Parcel() { // Arrange, Act ParcelVariable firstParcel = new ParcelVariable(1, 2, 3, 4, "string"); ParcelVariable secondParcel = new ParcelVariable(1, 2, 3, 4, "string"); // Assert Assert.AreEqual(firstParcel, secondParcel); }
public ActionResult ParcelGroup() { ParcelVariable myParcelVariable = new ParcelVariable(); myParcelVariable.SetLength(int.Parse(Request.Query["length"])); myParcelVariable.SetHeight(int.Parse(Request.Query["height"])); myParcelVariable.SetWeight(int.Parse(Request.Query["weight"])); myParcelVariable.SetWidth(int.Parse(Request.Query["width"])); return(View("Parcel_Info", myParcelVariable)); }
public ActionResult Results() { ParcelVariable myParcelVariable = new ParcelVariable(); myParcelVariable.SetWidth(Request.Query["width"]); myParcelVariable.SetLength(Request.Query["length"]); myParcelVariable.SetHeight(Request.Query["height"]); myParcelVariable.SetWeight(Request.Query["weight"]); return(View(myParcelVariable)); }
public ActionResult Parcels() { ParcelVariable newParcelVariable = new ParcelVariable(); newParcelVariable.SetWidth(int.Parse(Request.Query["parcel-width"])); newParcelVariable.SetLength(int.Parse(Request.Query["parcel-length"])); newParcelVariable.SetHeight(int.Parse(Request.Query["parcel-height"])); //newParcelVariable.GetVolume(int.Parse(Request.Query["parcel-height"])); return(View(newParcelVariable)); }
public ActionResult Create(ParcelVariable newParcel) { if (newParcel.SideA > 0 && newParcel.SideB > 0 && newParcel.SideC > 0 && newParcel.Weight > 0 && newParcel.Note.Length > 0) { Console.WriteLine(newParcel); _db.ParcelTable.Add(newParcel); _db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Parcels() { ParcelVariable myParcelVariable = new ParcelVariable(); myParcelVariable.SetHeight(int.Parse(Request.Query["height"])); myParcelVariable.SetWidth(int.Parse(Request.Query["width"])); myParcelVariable.SetLength(int.Parse(Request.Query["length"])); myParcelVariable.SetWeight(int.Parse(Request.Query["weight"])); myParcelVariable.SetDistance(int.Parse(Request.Query["distance"])); return(View(myParcelVariable)); }
public void Find_ReturnsCorrectItemFromDatabase_Parcel() { //Arrange ParcelVariable newParcel = new ParcelVariable(1, 2, 3, 4, "string"); newParcel.Save(); ParcelVariable newParcel2 = new ParcelVariable(1, 2, 3, 4, "string"); newParcel2.Save(); //Act ParcelVariable parcelFound = ParcelVariable.Find(newParcel.ID); //Assert Assert.AreEqual(newParcel, parcelFound); }
public void Volume_Returns_True() { //Arrange int _width = 2; int _height = 2; int _length = 2; int _volume = ParcelVariable.GetVolume(); ParcelVariable newParcelVariable = new ParcelVariable(_volume); //Act //Assert Assert.AreEqual(8, _volume); }
public ActionResult Parcels() { ParcelVariable myParcelVariable = new ParcelVariable(); myParcelVariable.SetRecipient(Request.Query["recip"]); string stringWeight = Request.Query["weight"]; myParcelVariable.SetWeight(int.Parse(stringWeight)); string stringDimX = Request.Query["dimX"]; myParcelVariable.SetDimX(int.Parse(stringDimX)); string stringDimY = Request.Query["dimY"]; myParcelVariable.SetDimY(int.Parse(stringDimY)); string stringDimZ = Request.Query["dimZ"]; myParcelVariable.SetDimZ(int.Parse(stringDimZ)); return(View("Parcels", myParcelVariable)); }
public void Dispose() { ParcelVariable.ClearAll(); }
public ActionResult Edit(ParcelVariable foundParcel) { _db.Entry(foundParcel).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }