public ActionResult Create(Item Item, HttpPostedFileBase ImageFile) { if (ImageFile == null) { ModelState.AddModelError("Image", "Please Upload an Image"); } bool isValidFormat = itemBll.CheckImageFormat(ImageFile); if (isValidFormat == false) { ModelState.AddModelError("Image", "Only jpg , png , jpeg are allowed"); } Item.IsDeleted = false; if (ModelState.IsValid) { status = itemBll.Create(Item, ImageFile); if (status == true) { ViewBag.Msg = "Item Category Successfully Added"; ModelState.Clear(); ViewBag.ItemCategoryId = dropDown.GetAllItemCategory(); return(View()); } if (status == false) { ViewBag.Msg = "Item Category Added Failed"; } } ViewBag.ItemCategoryId = dropDown.GetAllItemCategory(); return(View(Item)); }