Ejemplo n.º 1
0
        public ActionResult AddChannelList()
        {
            if (Session["Userid"] == null)
            {
                return(RedirectToAction("Login", "User"));
            }
            List <Channel> channelList = new List <Channel>();

            List <MarkerChannel> markerList    = new List <MarkerChannel>();
            MarkerChannel        markerChannel = new MarkerChannel();
            Channel ch = new Channel();

            ch.ChannelName        = Request.Form["Name"];
            ch.ChannelDescription = Request.Form["Description"];
            ch.CreationDate       = DateTime.Today;
            ch.Status             = false;
            ch.UserId             = Convert.ToInt32(Session["Userid"]);



            //rest are undone

            /*int len = Convert.ToInt16(Request.Form["len"]);
             * for (int i = 0; i < len; i++)
             * {
             *  markerChannel = new MarkerChannel();
             *  markerChannel.MarkerName = Request.Form["name[" + i + "]"];
             *  markerChannel.Lat = Convert.ToDouble(Request.Form["lat[" + i + "]"]);
             *  markerChannel.Longi = Convert.ToDouble(Request.Form["lng[" + i + "]"]);
             *  markerChannel.UserId = Convert.ToInt32(Session["Userid"]);
             *  markerList.Add(markerChannel);
             * }*/
            //return View(markerList);

            channelService.AddChannel(ch);
            channelList = channelService.GetAllChannel();

            return(RedirectToAction("MyChannel", "User", channelList));

            //return View();
        }