Ejemplo n.º 1
0
        public IActionResult Create(Property Property)
        {
            //Create a shell property attributes record
            Guid PropertyAttributeId            = Guid.NewGuid();
            PropertyAttribute propertyAttribute = new PropertyAttribute()
            {
                Id = PropertyAttributeId
            };

            propertyAttributeService.CreatePropertyAttribute(propertyAttribute);
            propertyAttributeService.SaveChanges();

            //Create the property
            Property.Id = Guid.NewGuid();
            Property.PropertyAttributes = propertyAttributeService.ReturnSinglePropertyAttribute(PropertyAttributeId);
            propertyService.CreateProperty(Property);
            propertyService.SaveChanges();

            //Update the property status
            SystemJob job = systemJobService.ReturnSingleSystemJob("Calculate property status");

            systemJobService.ExecuteSystemJob(job);

            return(RedirectToAction("SetInitialValues", "PropertyAttribute", new { PropertyAttributeId = PropertyAttributeId, PropertyId = Property.Id }));
        }
        public IActionResult Manage(PropertyAttributeViewModel model)
        {
            EPCRating    EPC          = EPCRatingService.ReturnSingleEPCRating(model.PropertyAttribute.EPCRating.Id);
            TenureType   TenureType   = TenureTypeService.ReturnSingleTenureType(model.PropertyAttribute.TenureType.Id);
            PropertyType PropertyType = PropertyTypeService.ReturnSinglePropertyType(model.PropertyAttribute.PropertyType.Id);

            model.PropertyAttribute.EPCRating    = EPC;
            model.PropertyAttribute.TenureType   = TenureType;
            model.PropertyAttribute.PropertyType = PropertyType;

            PropertyAttributeService.UpdatePropertyAttribute(model.PropertyAttribute);
            PropertyAttributeService.SaveChanges();

            return(RedirectToAction("PropertyDetails", "Property", new { PropertyId = model.PropertyId }));
        }