예제 #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 async Task <IViewComponentResult> InvokeAsync(Guid PropertyAttributeId, Guid PropertyId)
        {
            var model = new PropertyAttributeViewModel();

            model.PropertyAttribute = PropertyAttributeService.ReturnSinglePropertyAttribute(PropertyAttributeId);
            model.PropertyId        = PropertyId;

            ViewBag.EPCRating    = new SelectList(EPCRatingService.GenerateDropDownList(), "Id", "EPCRatingName");
            ViewBag.TenureType   = new SelectList(TenureTypeService.GenerateDropDownList(), "Id", "TenureTypeName");
            ViewBag.PropertyType = new SelectList(PropertyTypeService.GenerateDropDownList(), "Id", "PropertyTypeName");

            return(View(model));
        }
        public IActionResult SetInitialValues(Guid PropertyAttributeId, Guid PropertyId)
        {
            PropertyAttributeViewModel model = new PropertyAttributeViewModel
            {
                PropertyId        = PropertyId,
                PropertyAttribute = PropertyAttributeService.ReturnSinglePropertyAttribute(PropertyAttributeId)
            };

            ViewBag.EPCRating  = new SelectList(EPCRatingService.GenerateDropDownList(), "Id", "EPCRatingName");
            ViewBag.TenureType = new SelectList(TenureTypeService.GenerateDropDownList(), "Id", "TenureTypeName");

            return(View(model));
        }