Пример #1
0
        // GET: Books/Random
        public ActionResult Random()
        {
            var book = new Book()
            {
                Name = "War and Peace"
            };
            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Customer 1"
                },
                new Customer {
                    Name = "Customer 2"
                }
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            //ViewData["Book"] = book;
            //ViewBag.Book = book;

            return(View(viewModel));
        }
Пример #2
0
        //------------RANDOM--------------------
        public ActionResult Random()
        {
            var book = new Book()
            {
                Title = "Dandelion Wine", Author = "Ray Bradbury", Genre = "Novel, Science Fiction, Fantasy Fiction, Fictional Autobiography"
            };
            var readers = new List <Reader>
            {
                new Reader {
                    Name = "Reader 1"
                },
                new Reader {
                    Name = "Reader 2"
                },
            };

            var viewModel = new RandomBookViewModel
            {
                Book    = book,
                Readers = readers
            };


            return(View(viewModel));
        }
Пример #3
0
        // GET: Books/BlindDate
        public ActionResult BlindDate()
        {
            var book = new Book()
            {
                Name = "Dances With Wolves"
            };

            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Customer 1", Id = 1
                },
                new Customer {
                    Name = "Customer 2", Id = 2
                }
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            return(View(viewModel));
        }
Пример #4
0
        //private IEnumerable<Book> GetBooks()
        //{
        //    return new List<Book>
        //    {
        //        new Book {Id=1,Name="Ramayan"},
        //        new Book {Id=2,Name="Mahabaratham"}
        //    };
        //}

        //GET: Movies/Random
        public ActionResult Random()
        {
            var book = new Book()
            {
                Name = "Ramayan"
            };

            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Priyanka"
                },
                new Customer {
                    Name = "Vinay"
                }
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            return(View(viewModel));
        }
Пример #5
0
        // GET: Books/Random
        public ActionResult Random()
        {
            var book = new Book
            {
                Name = "The White Tiger!"
            };

            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Customer 1"
                },
                new Customer {
                    Name = "Customer 2"
                },
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            return(View(viewModel));

            //ViewData["Book"] = book;

            //ViewBag.Book = book;

            //return View();

            //return View(book);

            //return Content("Hello World!");

            //return HttpNotFound();

            // return new EmptyResult();

            // return RedirectToAction("Index","Home", new { page = 1, sortBy ="Id"});

            // return Json(new { Name = "Vipin Yadav", ID = 9, DateOfBirth = new DateTime(1989, 11, 08) }, JsonRequestBehavior.AllowGet);


            // To Download File
            //return File(Url.Content("~/Assets/Files/testFile.txt"), "text/plain", "testFile.txt");

            // To Display content on Browser
            //byte[] fileBytes = System.IO.File.ReadAllBytes(Server.MapPath("~/Assets/Files/testFile.txt"));
            //return File(fileBytes, "text/plain");

            //return Redirect("http://vipinkumaryadav.com/");
        }
Пример #6
0
        // GET: Books/Random
        public ActionResult Random()
        {
            var book = new Book()
            {
                BookName      = "ASP.NET 4.5 in C#",
                AuthorName    = "Mosh Hamedani",
                PublisherName = "Udemy Publication",
                PublishDate   = new DateTime(2015, 12, 08)
            };
            var customers = new List <Customer>()
            {
                new Customer()
                {
                    CustomerName = "customer 1"
                },
                new Customer()
                {
                    CustomerName = "customer 2"
                }
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            //3.way
            return(View(viewModel));

            //1.way ViewData["RandomBook"] = book1;
            //2.way ViewBag.RandomBook = book1;
            //return View();


            //return Content("Hello World!" );
            //return HttpNotFound();
            //return new EmptyResult();
            //return RedirectToAction("index", "Home", new{ page = 1,sortBy = "BookName"});
        }
Пример #7
0
        public ActionResult Random()
        {
            var book = new Book()
            {
                Title = "Moara cu Noroc!"
            };
            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Customer 1"
                },
                new Customer {
                    Name = "Customer 2"
                }
            };
            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers,
            };

            return(View(viewModel));
        }
Пример #8
0
        // GET: Book/Random
        public ActionResult Random()
        {
            var book = new Book()
            {
                Name = "Book test"
            };
            var customers = new List <Customer>
            {
                new Customer {
                    Name = "Customer 1"
                },
                new Customer {
                    Name = "Customer 2"
                }
            };

            var viewModel = new RandomBookViewModel
            {
                Book      = book,
                Customers = customers
            };

            return(View(viewModel));
        }