public string Add(Setting entity) { if (entity == null) return "The entity was not provided."; _context.Settings.Add(entity); _context.SaveChanges(); _context.Dispose(); return string.Empty; }
public string Edit(Setting entity) { if (entity == null) return "the entity was not provided."; var current = _context.Settings.Find(entity.Id); if (current == null) return "the specified setting was not found."; current.Entry = entity.Entry; current.Key = entity.Key; _context.SaveChanges(); _context.Dispose(); return string.Empty; }
public SettingViewModel ToView(Setting entity) { return Mapper.Map<Setting, SettingViewModel>(entity); }