//* * * UPDATE METHODS public Property editProperty(int propertyId, string propertyJSON) { Property updatedProperty = EMConverter.fromJSONtoA <Property>(propertyJSON); updatedProperty = mediator.DataManager.editProperty(propertyId, updatedProperty); ///need to update benchmark stats in case property type has been changed EMDatabaseStats.updateBenchmarkStats(); return(updatedProperty); }
public List <AnonymousProperty> getComparativeCostsForUser(int userId) { List <Property> usersProperties = mediator.DataManager.getProperties(userId); List <AnonymousProperty> anonProperties = new List <AnonymousProperty>(); List <AnonymousProperty> allProperties = EMDatabaseStats.getAllPropertyAnnualCosts(); List <AnonymousProperty> result = new List <AnonymousProperty>(); foreach (AnonymousProperty anonProperty in allProperties) { AnonymousProperty resultProperty = new AnonymousProperty(); resultProperty.Id = anonProperty.Id; resultProperty.Postcode = anonProperty.Postcode; resultProperty.AnnualCost = anonProperty.AnnualCost; resultProperty.isUsers = usersProperties.ToList().Exists(p => p.Id == anonProperty.Id); result.Add(resultProperty); } return(result); }