예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public SettingViewModel ToView(Setting entity)
 {
     return Mapper.Map<Setting, SettingViewModel>(entity);
 }