Ejemplo n.º 1
0
 /// <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));
     }
 }
Ejemplo n.º 2
0
        public void ApplyTo(string path)
        {
            var releases = resolver.Resolve(path);

            if (releases == null || !releases.Any())
            {
                return;
            }
            editor.Edit(path, releases);
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }