示例#1
0
        public int AddUpdateBlog(BlogMaster blog)
        {
            blog.CreatedDate = DateTime.Now;
            HIQAdminContext.BlogMasters.Add(blog);
            HIQAdminContext.SaveChanges();

            return(blog.ID);
        }
        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));
        }
示例#3
0
        public int AddUpdateBlog(BlogMasterDTO blog)
        {
            BlogMaster Blog = mapper.Map <BlogMaster>(blog);

            return(AdminRepository.AddUpdateBlog(Blog));
        }