public ActionResult Index()
        {
            var viewData = new Models.HomeIndexViewModel();

            // If logged in create the Facebook metadata for the logged in user using the Comapi web service.
            if (Request.IsAuthenticated)
            {
                try
                {
                    viewData.FacebookMetaData = GetFacebookMetaData(User.Identity.Name);
                }
                catch (Exception ex)
                {
                    // An error occurred.
                    viewData.TestMessageResult = new Models.ResultFeedback()
                    {
                        Success         = false,
                        FeedbackMessage = string.Format(@"Failed to generate Facebook metadata the error message was: {0}", ex.Message)
                    };
                }
            }

            // Render the view with the model
            return(View(viewData));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            var viewData = new Models.HomeIndexViewModel();

            // If logged in create the Facebook metadata for the logged in user using the Engagement Cloud CPaaS web service.
            if (Request.IsAuthenticated)
            {
                try
                {
                    viewData.FacebookMetaData = GetFacebookMetaData(User.Identity.Name);
                    viewData.FacebookPageId   = FACEBOOK_PAGE_ID;
                }
                catch (Exception ex)
                {
                    // An error occurred.
                    viewData.TestMessageResult = new Models.ResultFeedback()
                    {
                        Success         = false,
                        FeedbackMessage = "Failed to generate Facebook metadata, please check the console logs",
                        ErrorMessage    = HttpUtility.JavaScriptStringEncode(ex.Message)
                    };
                }
            }

            // Render the view with the model
            return(View(viewData));
        }
Beispiel #3
0
        public ActionResult Index(int?categoria)
        {
            //ViewBag.Carrinho = GetCarrinho();

            /*
             * var model = new Models.HomeIndexViewModel();
             * model.Produtos = new Models.Produto[4];
             * model.Produtos[0] = new Models.Produto();
             * model.Produtos[1] = new Models.Produto();
             * model.Produtos[2] = new Models.Produto();
             * model.Produtos[3] = new Models.Produto();
             */
            var model = new Models.HomeIndexViewModel();

            model.Produtos = _dal.GetProdutos();

            model.CategoriaSelecionada = categoria;

            model.Categorias = _dal.GetCategorias();



            if (categoria != null)
            {
                model.Produtos = model.Produtos
                                 .Where(x => x.IdCategoria == categoria)
                                 .ToArray();
            }
            return(View(model));
        }
Beispiel #4
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new Models.HomeIndexViewModel
            {
                CurrentWeather = await _weatherService.GetWeatherAsync()
            };

            return(View(viewModel));
        }
Beispiel #5
0
        public ActionResult Index()
        {
            var user = db.AspNetUsers.Find(User.Identity.GetUserId());
            HomeIndexViewModel viewModel = new Models.HomeIndexViewModel();

            viewModel.OwnerSocialClubName  = user.SocialClubName;
            viewModel.ConfigurationEnabled = String.IsNullOrEmpty(user.SocialClubName);
            return(View(viewModel));
        }
Beispiel #6
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new Models.HomeIndexViewModel
            {
                CurrentWeather = await _weatherService.GetWeatherAsync(),
                BackEndUrl     = _settings.BackendUrl
            };

            return(View(viewModel));
        }
Beispiel #7
0
        public ActionResult Index()
        {
            var goods1 = goodsManager.GetGoods();
            var goodsk = goodskManager.GetGoodsK();

            Models.HomeIndexViewModel homevm = new Models.HomeIndexViewModel();
            homevm.Goods1 = goods1;
            homevm.Goodsk = goodsk;
            return(View(homevm));
        }
Beispiel #8
0
        public ActionResult TestMessage()
        {
            var viewData = new Models.HomeIndexViewModel();

            try
            {
                // Create the Facebook metadata for the logged in user using the Engagement Cloud CPaaS web service.
                viewData.FacebookMetaData = GetFacebookMetaData(User.Identity.Name);

                // Send a test message via the Engagement Cloud CPaaS "One" API

                // Setup the channel options to indicate this is a A2P post purchase message
                dynamic fbMessengerOptions = new ExpandoObject();
                fbMessengerOptions.messagingType = "MESSAGE_TAG";
                fbMessengerOptions.messageTag    = "POST_PURCHASE_UPDATE";

                // Create the request
                var myRequest = new FacebookSendRequest()
                {
                    to = new FacebookSendRequest.toStruct()
                    {
                        profileId = User.Identity.Name
                    },                                                                          // Current logged in user
                    body           = "A test message sent via Engagement Cloud CPaaS!",
                    channelOptions = new FacebookSendRequest.channelOptionsStruct()
                    {
                        fbMessenger = fbMessengerOptions
                    }
                };

                // Send it
                SendFacebookMessage(myRequest);

                // Set the result
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = true,
                    FeedbackMessage = "Test message sent successfully, check Facebook Messenger"
                };
            }
            catch (Exception ex)
            {
                // An error occurred.
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = false,
                    FeedbackMessage = "The web service call failed, check the console logs",
                    ErrorMessage    = HttpUtility.JavaScriptStringEncode(ex.Message)
                };
            }

            // Render the view with the model
            return(View("Index", viewData));
        }
        public ActionResult TestRichMessage()
        {
            var viewData = new Models.HomeIndexViewModel();

            try
            {
                // Create the Facebook metadata for the logged in user using the Comapi web service.
                viewData.FacebookMetaData = GetFacebookMetaData(User.Identity.Name);

                // Send a test message via the Comapi "One" API

                // Create the request
                var myRequest = new FacebookSendRequest()
                {
                    to = new FacebookSendRequest.toStruct {
                        profileId = User.Identity.Name
                    },                                                                        // Current logged in user
                    customBody = new FacebookSendRequest.customBodyStruct {
                        fbMessenger = @"
                        {
                          ""attachment"": {
                            ""type"": ""image"",
                            ""payload"": {
                                        ""url"": ""https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/17156020_1871286216424427_1662368582524349363_n.jpg?oh=22685c22a19fc2e28e69634e6a920972&oe=592FD3D1""
                            }
                                }
                        }"
                    }
                };

                // Send it
                SendFacebookMessage(myRequest);

                // Set the result
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = true,
                    FeedbackMessage = "Test message sent successfully, check Facebook"
                };
            }
            catch (Exception ex)
            {
                // An error occurred.
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = false,
                    FeedbackMessage = string.Format(@"The web service call failed: {0}", ex.Message)
                };
            }

            // Render the view with the model
            return(View("Index", viewData));
        }
 public ActionResult Index()
 {
     using (var db = new Models.Northwind())
     {
         var model = new Models.HomeIndexViewModel
         {
             VisitorCount = (new Random()).Next(500, 901),
             Products     = db.Products.ToArray()
         };
         return(View(model)); // pass model to view
     }
 }
Beispiel #11
0
        public ActionResult Index(int?id)
        {
            var model = new Models.HomeIndexViewModel();

            model.Produtos = _dal.Produtos.ToArray();
            /*Fazendo um filtro categoria do produto*/
            if (id != null)
            {
                model.Produtos = model.Produtos.Where(p => p.CategoriaId == id).ToArray();
            }
            return(View(model));
        }
Beispiel #12
0
        public ActionResult DetalheCarousel(int id)
        {
            var model = new Models.HomeIndexViewModel();

            model.Carousels = _dal.Carousels.ToArray();

            model.Carousels = model.Carousels
                              .Where(p => p.CarouselId == id)
                              .ToArray();

            return(View(model));
        }
Beispiel #13
0
        public ActionResult NoticiaDetalhe(int id, int?Categoria)
        {
            var model = new Models.HomeIndexViewModel();

            model.Noticias = _dal.Noticias.ToArray();


            model.Noticias = model.Noticias
                             .Where(p => p.Id == id)
                             .ToArray();

            return(View(model));
        }
        //new MyCachingObjectService(
            //new ServiceLayer.WebAPI.MyObjectService(new ServiceLayer.WebAPI.HttpRequestManager("localhost", 25564)));

        public async Task<ActionResult> Index(int? pageNumber)
        {
            IServiceResponse lastResponse = (IServiceResponse)TempData["LastResponse"];
            var response = await _myObjectService.QueryMyObjects(new PagedQuery() { Page = pageNumber ?? 1 }.AsServiceRequest());
            //we should be doing some more advanced handling of API service errors.  See the MyObjects action for more.
            if (response.ErrorMessage != null)
                return View("ApiError", response);

            var viewModel = new Models.HomeIndexViewModel() { Results = Mapper.Map<PagedResult<MyObjectModel>>(response.Result), LastOperationResponse = lastResponse };
            if (viewModel.Results == null) //
                viewModel.Results = new PagedResult<MyObjectModel>();
            return View(viewModel);
        }
        public ActionResult Index()
        {
            var images     = imagesBLL.GetDAL().GetALL();
            var dynamics   = dynamicsBLL.GetDAL().GetList(3, 1);
            var users      = usersBLL.GetDAL().GetList(3, 1);
            var activities = activitiesBLL.GetDAL().GetList(3, 1);

            Models.HomeIndexViewModel homevm = new Models.HomeIndexViewModel();
            homevm.Images     = images;
            homevm.Dynamics   = dynamics;
            homevm.Users      = users;
            homevm.Activities = activities;
            return(View(homevm));
        }
Beispiel #16
0
        public ActionResult Index(int?id)
        {
            var model = new Models.HomeIndexViewModel();

            model.CategoriaSelecionada = id;
            model.Produtos             = _dal.Produtos.ToArray();
            model.Categorias           = _dal.Categorias.ToArray();

            if (id != null)
            {
                model.Produtos = model.Produtos
                                 .Where(p => p.CategoriaId == id)
                                 .ToArray();
            }
            return(View(model));
        }
        public ActionResult TestMessage()
        {
            var viewData = new Models.HomeIndexViewModel();

            try
            {
                // Create the Facebook metadata for the logged in user using the Comapi web service.
                viewData.FacebookMetaData = GetFacebookMetaData(User.Identity.Name);

                // Send a test message via the Comapi "One" API

                // Create the request
                var myRequest = new FacebookSendRequest()
                {
                    to = new FacebookSendRequest.toStruct()
                    {
                        profileId = User.Identity.Name
                    },                                                                          // Current logged in user
                    body = "A test message sent via Comapi!"
                };

                // Send it
                SendFacebookMessage(myRequest);

                // Set the result
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = true,
                    FeedbackMessage = "Test message sent successfully, check Facebook"
                };
            }
            catch (Exception ex)
            {
                // An error occurred.
                viewData.TestMessageResult = new Models.ResultFeedback()
                {
                    Success         = false,
                    FeedbackMessage = string.Format(@"The web service call failed: {0}", ex.Message)
                };
            }

            // Render the view with the model
            return(View("Index", viewData));
        }
Beispiel #18
0
        public ActionResult Index(int?id)
        {
            var model = new Models.HomeIndexViewModel();

            model.CidadeSelecionada = id;
            model.Cidades           = _dal.Cidades.ToArray();
            model.Noticias          = _dal.Noticias.OrderByDescending(p => p.Id).ToArray();
            model.Carousels         = _dal.Carousels.ToArray();


            if (id != null)
            {
                model.Noticias = model.Noticias
                                 .Where(p => p.CidadeId == id)
                                 .ToArray();
            }

            return(View(model));
        }
Beispiel #19
0
        public ActionResult Index(int?categoria)
        {
            ViewBag.Carrinho = GetCarrinho();

            var model = new Models.HomeIndexViewModel();

            model.CategoriaSelectionada = categoria;

            model.Produtos   = GetProdutos();
            model.Categorias = GetCategorias();

            if (categoria != null)
            {
                model.Produtos = model.Produtos
                                 .Where(p => p.IdCategoria == categoria)
                                 .ToArray();
            }

            return(View(model));
        }
Beispiel #20
0
        public ActionResult Index(int?categoria)
        {
            var model = new Models.HomeIndexViewModel();

            model.CategoriaSelecionada = categoria;

            model.Produtos   = _dal.Produtos.ToArray();
            model.Categorias = _dal.Categorias.ToArray();


            if (categoria != null)
            {
                model.Produtos = model.Produtos
                                 .Where(p => p.IdCategoria == categoria)
                                 .ToArray();
            }



            return(View(model));
        }
        public ActionResult Index()
        {
            Debug.Assert(SessionItems.TeacherId != null, "SessionItems.TeacherId != null");
            if (!DataRepository.GetTeachersClasses(SessionItems.TeacherId.Value).Any())
            {
                return(RedirectToAction("Add", "Classes"));
            }
            else
            {
                ViewBag.Title = "Assessment App";
                var classes = DataRepository.GetTeachersClasses(SessionItems.TeacherId.Value).Where(x => x.Active).OrderBy(x => x.ClassName);
                var model   = new Models.HomeIndexViewModel {
                    Classes = classes.Select(s =>
                    {
                        Debug.Assert(s.Id != null, "s.Id != null");
                        return(new SelectListItem {
                            Value = s.Id.Value.ToString(), Text = s.ClassName
                        });
                    }).ToList()
                };

                return(View(model));
            }
        }