コード例 #1
0
        public void WhenISendTheData()
        {
            var task = _propertyDriver.AddBiddingProperty(propertyTitle, askingPrice);

            task.Wait();
            _biddingProperty = task.Result;
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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"));
        }
コード例 #9
0
        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();
            }
        }
コード例 #10
0
        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));
        }
コード例 #11
0
 public Task <BiddingProperty> AddBiddingProperty(BiddingProperty property)
 {
     property.Id = 1;
     return(Task.FromResult(property));
 }