Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public dynamic UpdateConcreteValue(string name, string key, dynamic value)
- {
- var updateConfig = _context.Configurations.SingleOrDefault(x => x.ConfigName == name);
- var newlowercase = key.ToLowerInvariant();
- switch (newlowercase)
- {
- case "hostingname":
- updateConfig.HostingName = value;
- _context.Entry(updateConfig).State = EntityState.Modified;
- _context.SaveChanges();
- return updateConfig;
- case "typeofhosting":
- updateConfig.TypeOfHosting = value;
- _context.Entry(updateConfig).State = EntityState.Modified;
- _context.SaveChanges();
- return updateConfig;
- case "emailadress":
- updateConfig.EmailAdress = value;
- _context.Entry(updateConfig).State = EntityState.Modified;
- _context.SaveChanges();
- return updateConfig;
- case "ftpusername":
- updateConfig.FtpUserName = value;
- _context.Entry(updateConfig).State = EntityState.Modified;
- _context.SaveChanges();
- return updateConfig;
- case "registration":
- if (value == "enabled")
- updateConfig.Registration = true;
- if (value == "disable")
- updateConfig.Registration = false;
- _context.Entry(updateConfig).State = EntityState.Modified;
- _context.SaveChanges();
- return updateConfig;
- default:
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement