Example #1
0
        public JsonResult AddedProperty(PropertyResponse model)
        {
            CreatePropertyRequest request = new CreatePropertyRequest();
            request.PropertyID = model.PropertyID;
            request.StreetName = model.StreetName;
            request.StreetNumber = model.StreetNumber;
            request.City = model.City;
            request.ComplexName = model.ComplexName;
            request.PostalCode = model.PostalCode;
            request.PropertyID = model.PropertyID;
            request.PropertyType = model.PropertyType;
            request.UnitNumber = model.UnitNumber;
            request.Suburb = model.Suburb;

            var result = ApiWrapper.Post<PropertyResponse>("api/property/add", request);

            return Json(result);
        }
Example #2
0
        public static Property Create(PropertyResponse response)
        {
            if (response == null)
                return null;

            Property property = new Property();
            property.PropertyID = response.PropertyID;
            property.StreetName = response.StreetName;
            property.StreetNumber = response.StreetNumber;
            property.City = response.City;
            property.ComplexName = response.ComplexName;
            property.PostalCode = response.PostalCode;
            property.PropertyID = response.PropertyID;
            property.PropertyType = response.PropertyType;
            property.UnitNumber = response.UnitNumber;

            return property;

        }
Example #3
0
        public ActionResult AddProperty(int propertyID = 0)
        {
            PropertyResponse formModel = new PropertyResponse();

            if (propertyID != 0)
            {
                PropertyResponse property = ApiWrapper.Get<PropertyResponse>("api/property/" + propertyID);
                formModel.PropertyID = property.PropertyID;
                formModel.StreetName = property.StreetName;
                formModel.StreetNumber = property.StreetNumber;
                formModel.City = property.City;
                formModel.ComplexName = property.ComplexName;
                formModel.PostalCode = property.PostalCode;
                formModel.PropertyID = property.PropertyID;
                formModel.PropertyType = property.PropertyType;
                formModel.UnitNumber = property.UnitNumber;
                formModel.Suburb = property.Suburb;
            }


            return View("Add", formModel);
        }
Example #4
0
        public JsonResult Get(int id)
        {
            PropertyResponse response = null;

            Property property = db.Properties.Where(x => x.PropertyID == id).FirstOrDefault();

            if (property != null)
            {
                response = new PropertyResponse();

                response.PropertyID = property.PropertyID;
                response.PropertyType = property.PropertyType;
                response.UnitNumber = property.UnitNumber;
                response.ComplexName = property.ComplexName;
                response.StreetNumber = property.StreetNumber;
                response.StreetName = property.StreetName;
                response.Suburb = property.Suburb;
                response.City = property.City;
                response.PostalCode = property.PostalCode;
            }

            return Json(response, JsonRequestBehavior.AllowGet);
        }