Example #1
0
        public HelloWorldViewModel()
        {
            HelloWorldModel helloWorldModel = new HelloWorldModel();

            titleString = helloWorldModel.ImportantInfo;
            JoueurName  = "Joueur";
        }
Example #2
0
        //
        // GET: /HelloWorld/
        public ActionResult Index()
        {
            var postedSignedRequest = Request.Form["signed_request"];
            var model = new HelloWorldModel(postedSignedRequest);

            return(View(model));
        }
Example #3
0
        // GET: HelloWorld
        public ActionResult Index()
        {
            var model = new HelloWorldModel();

            model.Message = "Hello World!";
            return(View("Index", model));
        }
        public ActionResult RandomNumber()
        {
            HelloWorldModel model = new HelloWorldModel();

            model.RandNumber = new Random().Next(0, 100);
            return(View("Random", model));
        }
Example #5
0
        public async Task <HttpResponseMessage> Get()
        {
            HelloWorldModel model = new HelloWorldModel();

            model.ReturnValue = ConfigurationManager.AppSettings["ReturnValueText"];
            return(Request.CreateResponse(HttpStatusCode.OK, model.ReturnValue));
        }
        public async Task <HelloWorldModel> CreateAsync(HelloWorldModel helloWorld)
        {
            var tasks = _repositories.Select(r => r.CreateAsync(helloWorld));
            await Task.WhenAll(tasks);

            return(helloWorld);
        }
Example #7
0
        public ActionResult RandomNumber()
        {
            var model = new HelloWorldModel();

            model.GeneratedNumber = new Random().Next(1, 50);
            return(View("RandomNumber", model));
        }
        public IActionResult Index()
        {
            var model = new HelloWorldModel();

            model.PageContext = "hello World";
            return(View(model));
        }
Example #9
0
        public HelloWorldModel GetMessage()
        {
            HelloWorldModel model = null;

            restClient.BaseUrl   = new Uri(ConfigurationManager.AppSettings.Get(AppSettings.HelloWorldApiUrl));
            restRequest.Resource = "helloworld";
            restRequest.Method   = Method.GET;
            restRequest.Parameters.Clear();

            try
            {
                var helloWorldResponse = restClient.Execute <HelloWorldModel>(restRequest);
                if (helloWorldResponse != null)
                {
                    if (helloWorldResponse.Data != null)
                    {
                        model = helloWorldResponse.Data;
                    }
                }
            }
            catch (Exception ex)
            {
                //Log the exception
            }
            return(model);
        }
Example #10
0
        public void HelloWorldSample3()
        {
            HelloWorldModel model = new HelloWorldModel {
                Property = "", Value = 999
            };

            TestRunner.Test(model);
        }
Example #11
0
        public void HelloWorldSample2()
        {
            HelloWorldModel model = new HelloWorldModel {
                Value = 17
            };

            TestRunner.Test(model);
        }
        public ActionResult Index()
        {
            HelloWorldModel model = new HelloWorldModel();

            model.Message        = this.HelloWorldMessage;
            model.TeaserImageUrl = this.TeaserImageUrl;

            return(View(model));
        }
        public HelloWorldModel Get(int id)
        {
            var bll  = ObjectFactory.GetInstance <IHelloWorldRepository>();
            var item = new HelloWorldModel();

            item.Id       = id;
            item.Greeting = bll.Get(id);

            return(item);
        }
Example #14
0
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HelloWorldModel model)
        {
            if (string.IsNullOrWhiteSpace(model?.Name))
            {
                return(new BadRequestObjectResult("Please pass a name on the query string or in the request body"));
            }

            return(new OkObjectResult($"Hello, {model.Name}"));
        }
Example #15
0
        public async Task <HelloWorldModel> CreateAsync(HelloWorldModel helloWorld)
        {
            using (var context = new HelloWorldDbContext())
            {
                context.HelloWorlds.Add(Mapper.Map <HelloWorld>(helloWorld));

                await context.SaveChangesAsync();

                return(helloWorld);
            }
        }
Example #16
0
        public async Task <HelloWorldModel> GetMessage()
        {
            HelloWorldModel model = new HelloWorldModel()
            {
                Message = "Hello world"
            };

            await MyTaskAsync();

            return(model);
        }
Example #17
0
        public ActionResult RandomNumber()
        {
            Random random       = new Random();
            int    randomNumber = random.Next();

            HelloWorldModel model = new HelloWorldModel();

            model.RandomNumber = randomNumber;

            return(View("RandomNumber", model));
        }
Example #18
0
 private void SetHelloWorldPostViewBag(HelloWorldModel helloWorldModel = null)
 {
     if (helloWorldModel is null)
     {
         SetHelloWorldGetViewBag();
     }
     else
     {
         SetGreetingPhrase(ModelState.IsValid ? helloWorldModel.Name : "Незнакомец");
         SetDateTime();
     }
 }
Example #19
0
        public ActionResult HelloWorld()
        {
            HelloWorldModel model = new HelloWorldModel
            {
                Name        = "Zvi Rotsztein",
                DOB         = Convert.ToDateTime("1987 - 01 - 01"),
                HomeTown    = "London",
                PathToImage = "https://beithorah.co.il/wp-content/uploads/2020/06/%D7%94%D7%A8%D7%91-%D7%A6%D7%91%D7%99-%D7%A8%D7%95%D7%98%D7%A0%D7%A9%D7%98%D7%99%D7%99%D7%9F-1.jpg"
            };

            return(View(model));
        }
Example #20
0
        public void TestOutput()
        {
            var model = new HelloWorldModel();

            model.Hello = "Hello World";
            var ser    = new DataContractJsonSerializer(typeof(HelloWorldModel));
            var stream = new MemoryStream();

            ser.WriteObject(stream, model);
            stream.Position = 0;
            var reader = new StreamReader(stream);

            Console.WriteLine("Json format: " + reader.ReadToEnd());
        }
        public ActionResult Index()
        {
            var result   = new HelloWorldModel();
            var response = Client.GetAsync(BaseUrl).Result;

            if (response.IsSuccessStatusCode)
            {
                result = response.Content.ReadAsAsync <HelloWorldModel>().Result;
            }
            else
            {
                result.DisplayText = response.Content.ReadAsAsync <HttpError>().Result.Message;
            }
            return(View(result));
        }
Example #22
0
        private DataInputs SetupTestRecord()
        {
            _db = new HelloWorldModel();

            var newData = new DataInputs
            {
                id            = 1,
                DataInputText = "Hello World"
            };

            _db.DataInputs.Add(newData);
            _db.SaveChanges();

            return(newData);
        }
Example #23
0
        public string Write()
        {
            try
            {
                HelloWorldModel model = _repository.GetMessage();
                Console.WriteLine(model.HelloText);
            }
            catch (Exception)
            {
                // TODO: logging
                // return failure
                return(string.Empty);
            }

            //return success
            return(_repository.WriteMessage());
        }
Example #24
0
        static async Task <HelloWorldModel> GetModelAsync(string path)
        {
            client.BaseAddress = new Uri("http://localhost:49739/");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

            HelloWorldModel     model    = null;
            HttpResponseMessage response = await client.GetAsync(path);

            if (response.IsSuccessStatusCode)
            {
                string json = await response.Content.ReadAsStringAsync();

                model = JsonConvert.DeserializeObject <HelloWorldModel>(json);
            }
            return(model);
        }
Example #25
0
        void Start()
        {
            VRSettings.renderScale = 1.5f;
            IElementsFactory elementsFactory = this.GetComponent <ElementsFactory>();

            HelloWorldModel vm             = new HelloWorldModel();
            IPage           page173        = new Page(this.MainPage);
            IStackLayout    stackLayout614 = new StackLayout(this.MainPage);
            ILabel          label900       = elementsFactory.CreateLabel("Tap the button");

            stackLayout614.AddElement(label900);
            ILabel label151 = elementsFactory.CreateLabel("{{ message }}");

            vm.message.Subscribe((x) =>
            {
                label151.Text = vm.message.Value;
            });
            stackLayout614.AddElement(label151);

            IButton button342 = elementsFactory.CreateButton("TAP");

            button342.AddOnClick(vm.onTap);
            stackLayout614.AddElement(button342);
        }
Example #26
0
        public async Task <HelloWorldModel> CreateAsync(HelloWorldModel helloWorld)
        {
            await _eventHandler.HandleAsync(Mapper.Map <HelloWorldAddedEvent>(helloWorld));

            return(helloWorld);
        }
Example #27
0
 void View_LoadText(object sender, EventArgs e)
 {
     //get the data from the model and sent it back to the method(s) you want to execute
     view.SetText(HelloWorldModel.DBData() + " It sure is a nice day.");
 }
Example #28
0
 public GetMessageServiceViewModel(ReceiveMessageModel valueMessage)
 {
     this.AmazonId = valueMessage.Id;
     Data          = this.GetMessageObject(valueMessage.Body);
 }
 public HelloWorldRepository()
 {
     helloWorld = new HelloWorldModel("Hello World");
 }
        public HelloWorldViewModel()
        {
            HelloWorldModel helloWorldModel = new HelloWorldModel();

            helloString = helloWorldModel.ImportantInfo;
        }