Ejemplo n.º 1
0
        public ViewResult Greet(GreetInput greetInput)
        {
            //var greetInput = new GreetInput() {FirstName = firstName, LastName = lastName};
            //var fullName = string.Format("{0} {1}", firstName, lastName);
            //greetInput.Validate();
            if (!this.ModelState.IsValid)
                return View("Index", greetInput);
            var message =  _greeterService.Greet(greetInput.FullName);
            this.ViewBag.Message = message;

            if (_dateTimeService.GetCurrent().Hour < 12)
                return View("MorningView");
            return View("AfternoonView");
        }
Ejemplo n.º 2
0
        public ViewResult Greet(GreetInput greetInput)
        {
            //var greetInput = new GreetInput() {FirstName = firstName, LastName = lastName};
            //var fullName = string.Format("{0} {1}", firstName, lastName);
            //greetInput.Validate();
            if (!this.ModelState.IsValid)
            {
                return(View("Index", greetInput));
            }
            var message = _greeterService.Greet(greetInput.FullName);

            this.ViewBag.Message = message;

            if (_dateTimeService.GetCurrent().Hour < 12)
            {
                return(View("MorningView"));
            }
            return(View("AfternoonView"));
        }
Ejemplo n.º 3
0
        public ViewResult Greet(GreetInput greetInput)
        {
            //var greetInput = new GreetInput {FirstName = FirstName, LastName = LastName};
            greetInput.Validate();
            if (!greetInput.IsValid)
            {
                //this.ViewData["greetInput"] = greetInput;
                return(View("Index", greetInput));
            }
            _greeter.Name = greetInput.FullName;
            var response = _greeter.Greet();

            this.ViewData["message"] = response;
            if (_dateTimeService.GetCurrentTime().Hour < 12)
            {
                return(View("MorningView"));
            }
            return(View("AfternoonView"));
            //return response;
        }