public void Delete(T entity) { if (entity == null) { throw new ArgumentNullException("entity"); } entities.Remove(entity); context.SaveChanges(); }
private void AddLocalisedData() { if (!_context.Cultures.Any()) { var translations = _hostingEnvironment.GetTranslationFile(); var locales = translations.First().Split(",").Skip(1).ToList(); var currentLocale = 0; locales.ForEach(locale => { currentLocale += 1; var culture = new Culture { Name = locale }; var resources = new List <Resource>(); translations.Skip(1).ToList().ForEach(t => { var line = t.Split(","); resources.Add(new Resource { Culture = culture, Key = line[0], Value = line[currentLocale] }); }); culture.Resources = resources; _context.Cultures.Add(culture); _context.SaveChanges(); }); } }
public void SaveUserGraph(Subscriber subscriber) { _context.ChangeTracker.TrackGraph (subscriber, e => ApplyStateUsingIsKeySet(e.Entry)); _context.SaveChanges(); }
public int SaveChanges() { return(_context.SaveChanges()); }