public ActionResult Index(WebPortalConfigurationsViewModel model)
        {
            _commonHelper = new CommonHelper();

            if (_commonHelper.UpdateHomeConfiguration(model))
            {
                Success("The home configurations updated successfully.", true);
            }
            else
            {
                Danger("The home configurations not updated successfully.", true);
            }

            return(View());
        }
Esempio n. 2
0
        public bool UpdateHomeConfiguration(WebPortalConfigurationsViewModel model)
        {
            using (camphorizonEntities db = new camphorizonEntities())
            {
                var config = db.ApplicationSettings.Where(x => x.Name == "Address").FirstOrDefault();
                config.Value           = model.Address;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                config                 = db.ApplicationSettings.Where(x => x.Name == "Helpline").FirstOrDefault();
                config.Value           = model.Contact;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                config                 = db.ApplicationSettings.Where(x => x.Name == "HelpEmail").FirstOrDefault();
                config.Value           = model.HelpEmail;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                config                 = db.ApplicationSettings.Where(x => x.Name == "WebsiteName").FirstOrDefault();
                config.Value           = model.WebsiteName;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                config                 = db.ApplicationSettings.Where(x => x.Name == "WelcomeText").FirstOrDefault();
                config.Value           = model.WelcomeText;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                config                 = db.ApplicationSettings.Where(x => x.Name == "AboutText").FirstOrDefault();
                config.Value           = model.AboutText;
                db.Entry(config).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(true);
            }
        }