public ActionResult Create(int categoryId)
 {
     var viewModel = new BlogManagerViewModel
     {
         Blog = new BlogMaster()
     };
     viewModel.Blog.CategoryId = categoryId;
     return View(viewModel);
 }
        public ActionResult Create(int categoryId)
        {
            var viewModel = new BlogManagerViewModel
            {
                Blog = new BlogMaster()
            };

            viewModel.Blog.CategoryId = categoryId;
            return(View(viewModel));
        }
        public ActionResult Create(BlogMaster Blog, int Categoryid)
        {
            if (ModelState.IsValid)
            {
                //Save Sub Category
                Blog.DateTime = System.DateTime.Now;
                Blog.UserId = 1;
                Blog.UserName = User.Identity.Name;
                Blog.CategoryId = Categoryid;
                shopDB.AddToBlogMasters(Blog);
                shopDB.SaveChanges();

                return RedirectToAction("Browse", "Category", new { Category = Blog.CategoryMaster.Name });
            }
            // Invalid – redisplay with errors
            var viewModel = new BlogManagerViewModel
            {
                Blog = new BlogMaster()
            };
            return View(viewModel);
        }
        public ActionResult Create(BlogMaster Blog, int Categoryid)
        {
            if (ModelState.IsValid)
            {
                //Save Sub Category
                Blog.DateTime   = System.DateTime.Now;
                Blog.UserId     = 1;
                Blog.UserName   = User.Identity.Name;
                Blog.CategoryId = Categoryid;
                shopDB.AddToBlogMasters(Blog);
                shopDB.SaveChanges();

                return(RedirectToAction("Browse", "Category", new { Category = Blog.CategoryMaster.Name }));
            }
            // Invalid – redisplay with errors
            var viewModel = new BlogManagerViewModel
            {
                Blog = new BlogMaster()
            };

            return(View(viewModel));
        }