Exemple #1
0
        public void ChangePropertyPrice_ReturnProperty()
        {
            var propertyChanged = _realStateAPIRepository.ChangePrice(1, 2000);

            var property = _realStateAPIRepository.GetPropertyById(1);

            Assert.IsTrue(property.Price == propertyChanged.Price);

            Assert.Pass();
        }
        public ActionResult <PropertyDTO> ChangePrice(int idProperty, decimal price)
        {
            try
            {
                Property property = _realStateAPIRepository.ChangePrice(idProperty, price);
                _realStateAPIRepository.Save();

                PropertyDTO propertyDTO = _mapper.Map <PropertyDTO>(property);
                return(propertyDTO);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }