Exemple #1
0
        /// <summary>
        /// Show Contact us update info
        /// </summary>
        /// <returns></returns>
        public ActionResult ContactUsInfo(long?country_code)
        {
            var countries = Db.Select <Country>();

            ViewData["Countries"] = countries;

            var country = new Country();

            if (country_code.HasValue)
            {
                country = countries.Where(m => m.Id == country_code.Value).FirstOrDefault();
            }
            else
            {
                country = countries.FirstOrDefault();
            }
            if (country == null)
            {
                country = new Country();
            }

            var info = Db.Select <Site_ContactusConfig>(x => x.Where(m => m.LanguageCode == country.Code).Limit(1)).FirstOrDefault();

            if (info == null)
            {
                info = new Site_ContactusConfig()
                {
                    Address = "", Coor_Lat = 37.996163f, Coor_Lng = -99.711914f, Center_Lat = 37.991163f, Center_Lng = -99.211914f, Info = "", AllowRouting = true, Id = 0, LanguageCode = country.Code
                };
            }
            return(View("ContactUsInfo", info));
        }
Exemple #2
0
        public ActionResult Index()
        {
            string country_code = Setting_GetCurrentCountry();

            var config = CurrentWebsite.Contactus_Info(country_code);

            if (config == null)
            {
                config = new Site_ContactusConfig()
                {
                    Address = ""
                };
            }
            else
            {
                config.Info = config.Info.Replace("\r\n", "");
            }

            ViewData["config"] = config;
            return(View(new Site_ContactUs()));
        }
Exemple #3
0
        public ActionResult ContactUsInfoUpdate(Site_ContactusConfig model, IEnumerable <HttpPostedFileBase> FileUp)
        {
            if (string.IsNullOrEmpty(model.Address))
            {
                return(JsonError("Please enter website Address location"));
            }

            if (string.IsNullOrEmpty(model.Info))
            {
                model.Info = "";
            }

            if (model.Id == 0)
            {
                Db.Insert <Site_ContactusConfig>(model);
            }
            else
            {
                Db.Update <Site_ContactusConfig>(model);
            }

            return(JsonSuccess(Url.Action("Detail", new { id = 1 })));
        }