public ActionResult ImageUpload()
        {
            ImageAndContentModel Model = new ImageAndContentModel();

            Model.Categories    = BL.CategoryDDL();
            Model.SubCategories = BL.SubCategoryDDLByCategory();

            return(View(Model));
        }
        public ActionResult ImageUpload(ImageAndContentModel Model)
        {
            HttpPostedFileBase file = Model.Files[0];

            Model.Categories = BL.CategoryDDL();
            string fileName = "";

            try
            {
                if (file != null && file.ContentLength > 0)
                {
                    string extension = Path.GetExtension(file.FileName);
                    fileName = Guid.NewGuid().ToString() + extension;
                    string filePath = Path.Combine(Server.MapPath("~/Images"), fileName);
                    file.SaveAs(filePath);
                }
            }
            catch (Exception ex)
            {
            }
            BL.AddImages(new Image()
            {
                ImagePath         = fileName,
                ParentSubCategory = Model.SelectedSubCategory,
                UpdateDate        = DateTime.Now
            });
            BL.AddContent(new Content()
            {
                TextContent       = Model.Content,
                ParentSubCategory = Model.SelectedSubCategory,
                UpdateDate        = DateTime.Now
            });
            Model.SubCategories    = BL.SubCategoryDDLByCategory();
            TempData["SuccessMsg"] = "Image is Added Successfully";
            return(RedirectToAction("ImageUpload"));
        }