Example #1
0
 private void AdPanel_MouseEnter(object sender, EventArgs e)
 {
     if (this.ContainsFocus)
     {
         AdPanel.Focus();
     }
 }
Example #2
0
 public ActionResult Delete(int?id)
 {
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TestProjectEntities db = new TestProjectEntities())
     {
         AdPanel AdPanel = db.AdPanels.Find(id);
         db.AdPanels.Remove(AdPanel);
         db.SaveChanges();
     }
     return(RedirectToAction("index"));
 }
Example #3
0
 public ActionResult Edit(AdPanel adpanel)
 {
     if (adpanel == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TestProjectEntities db = new TestProjectEntities())
     {
         AdPanel edited = db.AdPanels.Find(adpanel.Id);
         edited.Id   = adpanel.Id;
         edited.Name = adpanel.Name;
         edited.Text = adpanel.Text;
         db.SaveChanges();
     }
     return(RedirectToAction("index"));
 }
Example #4
0
        // GET: Client/Home
        public ActionResult Index()
        {
            using (TestProjectEntities db = new TestProjectEntities())
            {
                List <AdPanel> ads  = db.AdPanels.ToList();
                AdPanel        ad   = ads[ads.Count - 1];
                AdText         text = new AdText();
                text.Text    = ad.Text;
                ViewBag.Text = text.Text;
            }

            //Weatherinfo weather = new Weatherinfo();
            string             link      = string.Format("https://samples.openweathermap.org/data/2.5/weather");
            var                client    = new RestClient(link);
            var                request   = new RestRequest("?q=London&appid=439d4b804bc8187953eb36d2a8c26a02", Method.GET);
            List <Weatherinfo> wheathers = client.Execute <List <Weatherinfo> >(request).Data;

            return(View(wheathers));
        }
Example #5
0
 public ActionResult Create(AdPanel adpanel)
 {
     using (TestProjectEntities db = new TestProjectEntities())
     {
         AdPanel adpanel1 = db.AdPanels.FirstOrDefault(a => a.Id == adpanel.Id && a.Name == adpanel.Name && a.Text == adpanel.Text);
         if (adpanel1 != null)
         {
             return(Content("This item already exist"));
         }
         adpanel1 = new AdPanel()
         {
             Id   = adpanel.Id,
             Name = adpanel.Name,
             Text = adpanel.Text
         };
         db.AdPanels.Add(adpanel1);
         db.SaveChanges();
     }
     return(View());
 }