コード例 #1
0
        public ActionResult ServicesDetails(int id)
        {
            ROP_WEBEntities db = new ROP_WEBEntities();

            return(View(db.SERVICEs.FirstOrDefault(x => x.Service_Id == id)));
        }
コード例 #2
0
        public ActionResult FAQ()
        {
            ROP_WEBEntities db = new ROP_WEBEntities();

            return(View(db.FAQMains.ToList()));
        }
コード例 #3
0
        //   ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
        // GET: Home
        public ActionResult Index()
        {
            ROP_WEBEntities db      = new ROP_WEBEntities();
            ViewModel       mymodel = new ViewModel();
            //slider id 1 will be active one,, other normal
            List <Slider> slides = new List <Slider>();
            //use try andcatch for erorr control + id showd come from user request
            XElement xelement  = XElement.Load(HttpContext.Server.MapPath("~/ROP-Content/Xmls/Slider.xml"));
            var      slidslist = xelement.Elements();

            //   var element = (from Offense in OffenseClass where (int)Offense.Element("OffenseId") == 1 select Offense).ToList();

            foreach (XElement xEle in slidslist)
            {
                slides.Add(new Slider
                {
                    SlideId   = (int)xEle.Element("SlideId"),
                    SlideImg  = xEle.Element("SlideImg").Value,
                    SlideUrl  = xEle.Element("SlideUrl").Value,
                    SlideAlt  = xEle.Element("SlideAlt").Value,
                    SlideLang = xEle.Element("SlideLang").Value
                });
            }

            CultureInfo currentInfo = Thread.CurrentThread.CurrentCulture;

            if (currentInfo.IetfLanguageTag.ToString().Equals("ar-OM") || (currentInfo.IetfLanguageTag.ToString().Equals("ar")))
            {
                mymodel.Sliders = slides.Where(x => x.SlideLang == "ar").ToList();
            }
            else
            {
                mymodel.Sliders = slides.Where(x => x.SlideLang == "en").ToList();
            }
            //get last 3 ads/*******************************/


            //slider id 1 will be active one,, other normal
            List <Ad> ad = new List <Ad>();
            //use try andcatch for erorr control + id showd come from user request
            XElement adsxelement = XElement.Load(HttpContext.Server.MapPath("~/ROP-Content/Xmls/Ads.xml"));
            var      adslist     = adsxelement.Elements();

            //   var element = (from Offense in OffenseClass where (int)Offense.Element("OffenseId") == 1 select Offense).ToList();

            foreach (XElement xEle in adslist)
            {
                ad.Add(new Ad
                {
                    AdId      = (int)xEle.Element("AdId"),
                    AdTitle   = xEle.Element("AdTitle").Value,
                    Adtxt     = xEle.Element("Adtxt").Value,
                    Adimg     = xEle.Element("Adimg").Value,
                    Adfile    = xEle.Element("Adfile").Value,
                    AdLang    = xEle.Element("AdLang").Value,
                    AdEndDate = (DateTime)xEle.Element("AdEndDate")
                });;
            }


            if (currentInfo.IetfLanguageTag.ToString().Equals("ar-OM") || (currentInfo.IetfLanguageTag.ToString().Equals("ar")))
            {
                mymodel.Ads = ad.Where(x => x.AdLang == "ar").ToList();
            }
            else
            {
                mymodel.Ads = ad.Where(x => x.AdLang == "en").ToList();
            }


            //get last 4 news/***************************/


            if (currentInfo.IetfLanguageTag.ToString().Equals("ar-OM") || (currentInfo.IetfLanguageTag.ToString().Equals("ar")))
            {
                mymodel.News = db.NewsMains.Where(x => x.Show == true && x.Archive == false && x.Language == "ar").Take(4).ToList();
            }
            else
            {
                mymodel.News = db.NewsMains.Where(x => x.Show == true && x.Archive == false && x.Language == "en").Take(4).ToList();
            }


            return(View(mymodel));
        }