/// <summary> /// Used to load a named feature from an abstract location. /// </summary> public static Feature Load(string name, ISourceResolver finder) { using (var stream = finder.Resolve(name)) { return(Load(stream)); } }
public void ApplyTo(string path) { var releases = resolver.Resolve(path); if (releases == null || !releases.Any()) { return; } editor.Edit(path, releases); }
public async Task Add(Income income) { income.ClientId = _userAccessor.GetId(); income.Source = await _sourceResolver.Resolve(income.Source.Name); _context.Add(income); await _context.SaveChangesAsync(); var clientSource = await _clientSourceResolver.Resolve(income.ClientId, income.Source.Id); if (clientSource != null) { _context.ClientSources.Add(clientSource); await _context.SaveChangesAsync(); } }
public async Task Update(Income income) { var queriedIncome = await _context.Incomes.FindAsync(income.Id); if (queriedIncome == null) { throw new ArgumentException("Unable to update income because it doesn't exist"); } queriedIncome.Source = await _sourceResolver.Resolve(income.Source.Name); queriedIncome.Value = income.Value; queriedIncome.Date = income.Date; await _context.SaveChangesAsync(); var clientSource = await _clientSourceResolver.Resolve(queriedIncome.ClientId, queriedIncome.Source.Id); if (clientSource != null) { _context.ClientSources.Add(clientSource); await _context.SaveChangesAsync(); } }