public ActionResult AddBlog(BlogModel model, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         var blogDAO = new BlogDAO();
         var blog    = new Blog();
         blog.BlogID     = model.BlogID;
         blog.Title      = model.Title;
         blog.Body       = model.Body;
         blog.Author     = model.Author;
         blog.CreateDate = DateTime.Now;
         var    fileName = Path.GetFileName(file.FileName);
         var    filePath = fileName;
         string path     = Path.Combine(Server.MapPath("~/Content/Images"), fileName);
         file.SaveAs(path);
         model.BlogImg = filePath;
         blog.BlogImg  = model.BlogImg;
         blogDAO.AddBlog(blog);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }