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));
        }
        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 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 }));
        }