Advertisement
afterlife88

Untitled

Sep 21st, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 KB | None | 0 0
  1.     public dynamic UpdateConcreteValue(string name, string key, dynamic value)
  2.         {
  3.             var updateConfig = _context.Configurations.SingleOrDefault(x => x.ConfigName == name);
  4.             var newlowercase = key.ToLowerInvariant();
  5.             switch (newlowercase)
  6.             {
  7.                 case "hostingname":
  8.                     updateConfig.HostingName = value;
  9.                     _context.Entry(updateConfig).State = EntityState.Modified;
  10.                     _context.SaveChanges();
  11.                     return updateConfig;
  12.                 case "typeofhosting":
  13.                     updateConfig.TypeOfHosting = value;
  14.                     _context.Entry(updateConfig).State = EntityState.Modified;
  15.                     _context.SaveChanges();
  16.                     return updateConfig;
  17.                 case "emailadress":
  18.                     updateConfig.EmailAdress = value;
  19.                     _context.Entry(updateConfig).State = EntityState.Modified;
  20.                     _context.SaveChanges();
  21.                     return updateConfig;
  22.                 case "ftpusername":
  23.                     updateConfig.FtpUserName = value;
  24.                     _context.Entry(updateConfig).State = EntityState.Modified;
  25.                     _context.SaveChanges();
  26.                     return updateConfig;
  27.                 case "registration":
  28.                     if (value == "enabled")
  29.                         updateConfig.Registration = true;
  30.                     if (value == "disable")
  31.                         updateConfig.Registration = false;
  32.                     _context.Entry(updateConfig).State = EntityState.Modified;
  33.                     _context.SaveChanges();
  34.                     return updateConfig;
  35.                 default:
  36.                     return null;
  37.             }
  38.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement