void ReloadData() { var dataSource = _dataSourceFactory.GetDataSource(); ProfitData = new JellyBeanProfitCalculator(dataSource).CalculateProfit(); if (DataLoaded != null) { DataLoaded(); } }
public virtual async Task <ItemResult> ChangeSpacesToDashesInName([FromServices] IDataSourceFactory dataSourceFactory, int id) { var dataSource = dataSourceFactory.GetDataSource <Coalesce.Domain.Person, Coalesce.Domain.Person>("WithoutCases"); var(itemResult, _) = await dataSource.GetItemAsync(id, new ListParameters()); if (!itemResult.WasSuccessful) { return(new ItemResult(itemResult)); } var item = itemResult.Object; var methodResult = item.ChangeSpacesToDashesInName(); await Db.SaveChangesAsync(); var result = new ItemResult(methodResult); return(result); }
public virtual async Task <ItemResult <string> > ObfuscateEmail([FromServices] IDataSourceFactory dataSourceFactory, int id) { var dataSource = dataSourceFactory.GetDataSource <Coalesce.Domain.Person, Coalesce.Domain.Person>("Default"); var(itemResult, _) = await dataSource.GetItemAsync(id, new ListParameters()); if (!itemResult.WasSuccessful) { return(new ItemResult <string>(itemResult)); } var item = itemResult.Object; var methodResult = item.ObfuscateEmail(Db); await Db.SaveChangesAsync(); var result = new ItemResult <string>(); result.Object = methodResult; return(result); }
public virtual async Task <ItemResult <string> > AsyncMethodOnIClassDto([FromServices] IDataSourceFactory dataSourceFactory, int id, string input) { var dataSource = dataSourceFactory.GetDataSource <Coalesce.Domain.Case, Coalesce.Domain.CaseDto>("Default"); var itemResult = await dataSource.GetMappedItemAsync <Coalesce.Domain.CaseDto>(id, new ListParameters()); if (!itemResult.WasSuccessful) { return(new ItemResult <string>(itemResult)); } var item = itemResult.Object; var methodResult = await item.AsyncMethodOnIClassDto(input); await Db.SaveChangesAsync(); var result = new ItemResult <string>(); result.Object = methodResult; return(result); }
public virtual async Task <ItemResult> SaveWithDelay([FromServices] IDataSourceFactory dataSourceFactory, int id) { var dataSource = dataSourceFactory.GetDataSource <CoalescePlayground.Data.Models.Person, CoalescePlayground.Data.Models.Person>("Default"); var(itemResult, _) = await dataSource.GetItemAsync(id, new ListParameters()); if (!itemResult.WasSuccessful) { return(new ItemResult(itemResult)); } var item = itemResult.Object; item.SaveWithDelay(Db); await Db.SaveChangesAsync(); var result = new ItemResult(); return(result); }
public virtual async Task <ItemResult <PersonDtoGen> > ChangeFirstName([FromServices] IDataSourceFactory dataSourceFactory, int id, string firstName) { IncludeTree includeTree = null; var dataSource = dataSourceFactory.GetDataSource <Coalesce.Domain.Person, Coalesce.Domain.Person>("Default"); var(itemResult, _) = await dataSource.GetItemAsync(id, new ListParameters()); if (!itemResult.WasSuccessful) { return(new ItemResult <PersonDtoGen>(itemResult)); } var item = itemResult.Object; var methodResult = item.ChangeFirstName(firstName); await Db.SaveChangesAsync(); var result = new ItemResult <PersonDtoGen>(); var mappingContext = new MappingContext(User, ""); result.Object = Mapper.MapToDto <Coalesce.Domain.Person, PersonDtoGen>(methodResult, mappingContext, includeTree); return(result); }
public void Init(object initData) { GraphData = new JellyBeanGraphCalculator(_dataSourceFactory.GetDataSource()).GetGraphData(); }
public void Init(object initData) { JellyBeanValues = new ObservableCollection <Object>(_dataSourceFactory.GetDataSource().GetJellyBeanValues().Result); }