public Task Handle <T>(T cmd) where T : class
        {
            switch (cmd)
            {
            case V1.Register x:
                return(Execute(x.ClassifiedAdId, ad => ad.Register(x.ClassifiedAdId, x.OwnerId, _getUtcNow)));

            case V1.ChangeTitle x:
                return(Execute(x.ClassifiedAdId, ad => ad.ChangeTitle(x.Title, _getUtcNow)));

            case V1.ChangeText x:
                return(Execute(x.ClassifiedAdId, async ad =>
                {
                    var text = await AdText.Parse(x.Text, _checkTextForProfanity);
                    ad.ChangeText(text, _getUtcNow);
                }));

            case V1.ChangePrice x:
                return(Execute(x.ClassifiedAdId, ad => ad.ChangePrice(x.Price, _getUtcNow)));

            case V1.Publish x:
                return(Execute(x.ClassifiedAdId, ad => ad.Publish(_getUtcNow)));

            case V1.MarkAsSold x:
                return(Execute(x.ClassifiedAdId, ad => ad.MarkAsSold(_getUtcNow)));

            case V1.Remove x:
                return(Execute(x.ClassifiedAdId, ad => ad.Remove(_getUtcNow)));

            default:
                return(Task.CompletedTask);
            }
        }
Exemplo n.º 2
0
        void ReleaseDesignerOutlets()
        {
            if (AdText != null)
            {
                AdText.Dispose();
                AdText = null;
            }

            if (EmailTxt != null)
            {
                EmailTxt.Dispose();
                EmailTxt = null;
            }

            if (GeriButton != null)
            {
                GeriButton.Dispose();
                GeriButton = null;
            }

            if (GirisYapButton != null)
            {
                GirisYapButton.Dispose();
                GirisYapButton = null;
            }

            if (KayitOlButton != null)
            {
                KayitOlButton.Dispose();
                KayitOlButton = null;
            }

            if (SifreTekrarTxt != null)
            {
                SifreTekrarTxt.Dispose();
                SifreTekrarTxt = null;
            }

            if (SifreTxt != null)
            {
                SifreTxt.Dispose();
                SifreTxt = null;
            }

            if (SoyadText != null)
            {
                SoyadText.Dispose();
                SoyadText = null;
            }
        }
Exemplo n.º 3
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));
        }