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)); }
public int AddUpdateBlog(BlogMasterDTO blog) { BlogMaster Blog = mapper.Map <BlogMaster>(blog); return(AdminRepository.AddUpdateBlog(Blog)); }