public void WhenISendTheData() { var task = _propertyDriver.AddBiddingProperty(propertyTitle, askingPrice); task.Wait(); _biddingProperty = task.Result; }
public async Task <IActionResult> Add([FromBody] BiddingProperty property) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var addedProperty = await _biddingService.AddBiddingProperty(property); return(CreatedAtAction(nameof(GetById), new { id = addedProperty.Id }, addedProperty)); }
public async Task <BiddingProperty> AddBiddingProperty(BiddingProperty property) { var biddingProperty = new BiddingProperty() { Title = property.Title, AskingPrice = property.AskingPrice, IsBiddingActive = true }; _context.BiddingProperties.Add(biddingProperty); await _context.SaveChangesAsync(); return(biddingProperty); }
public async Task Add_ValidObjectPassed_ReturnsCreatedResponse() { // Arrange var biddingProperty = new BiddingProperty() { Title = "50 WoodBrook", AskingPrice = 350000.00M }; // Act var createdResponse = await _controller.Add(biddingProperty); // Assert Assert.IsInstanceOf <CreatedAtActionResult>(createdResponse); }
public async Task Add_InvalidObjectPassed_ReturnsBadRequest() { // Arrange var biddingProperty = new BiddingProperty() { AskingPrice = 350000.00M }; _controller.ModelState.AddModelError("Title", "Required"); // Act var badResult = await _controller.Add(biddingProperty); // Assert Assert.IsInstanceOf <BadRequestObjectResult>(badResult); }
public ActionResult bookprop(BiddingProperty bidquest) {//here we put it only if the value is greater than the percentage //we dont have records yet int f = bidquest.PropertyId; int count = 0; PropertyQuestion pqest = db.PropertyQuestions.Find(f); if (pqest.Response1 == bidquest.Response1) { count++; } if (pqest.Response2 == bidquest.Response2) { count++; } if (pqest.Response3 == bidquest.Response3) { count++; } if (pqest.Response4 == bidquest.Response4) { count++; } if (ModelState.IsValid) { if (pqest.Percentage <= ((count / 4) * 100)) { db.BiddingProperties.Add(bidquest); db.SaveChanges(); } ViewBag.message = "you have succesfully applied for the property"; return(RedirectToAction("Index")); } return(View(bidquest)); }
public async Task Add_ValidObjectPassed_ReturnedResponseHasCreatedProperty() { // Arrange var biddingProperty = new BiddingProperty() { Title = "50 WoodBrook", AskingPrice = 350000.00M }; // Act var createdResponse = await _controller.Add(biddingProperty) as CreatedAtActionResult; var property = createdResponse.Value as BiddingProperty; // Assert Assert.IsInstanceOf <BiddingProperty>(property); Assert.AreEqual(property.Title, biddingProperty.Title); Assert.AreEqual(property.AskingPrice, biddingProperty.AskingPrice); }
public ActionResult rejectreq(int idbh = 0) { BiddingProperty rt = db.BiddingProperties.Find(idbh);//this checks only the primary key BidRejected hj = new BidRejected(); hj.BidId = rt.BiddingId; hj.ClientId = rt.ClientId; hj.PropertyId = rt.PropertyId; ViewBag.teme = rt.PropertyId; db.BidRejecteds.Add(hj); db.BiddingProperties.Remove(rt); db.SaveChanges(); ViewBag.message = "the record has been rejected"; return(RedirectToAction("Index")); }
public void GivenIHaveAddedTheseProperties(Table table) { foreach (TableRow row in table.Rows) { var title = row["Title"]; var askingPrice = row["AskingPrice"]; // save the property to compare later var property = new BiddingProperty() { Title = title, AskingPrice = Convert.ToDecimal(askingPrice) }; _propertiesToAdd.Add(property); // add the property Task task = _propertyDriver.AddBiddingProperty(title, askingPrice); task.Wait(); } }
public ActionResult bookprop(int ido) { PropertyDetail nh = db.PropertyDetails.Find(ido); BiddingProperty hu = new BiddingProperty(); PropertyQuestion pq = db.PropertyQuestions.Find(ido); hu.PropertyId = ido; hu.ClientId = Convert.ToInt32(Session["Id"]); ViewBag.ques1 = pq.Question1; ViewBag.ques2 = pq.Question2; ViewBag.ques3 = pq.Question3; ViewBag.ques4 = pq.Question4; return(View(hu)); }
public Task <BiddingProperty> AddBiddingProperty(BiddingProperty property) { property.Id = 1; return(Task.FromResult(property)); }