public ActionResult Create(Organization organization, HttpPostedFileBase ImageFile) { if (ImageFile == null) { ModelState.AddModelError("Image", "Please Upload an Image"); } if (ImageFile != null) { bool isValidFormat = common.CheckImageFormat(ImageFile); if (isValidFormat == false) { ModelState.AddModelError("Image", "Only jpg , png , jpeg are allowed"); } else { byte[] convertedImage = common.ConvertImage(ImageFile); organization.Image = convertedImage; } } organization.IsDeleted = false; if (ModelState.IsValid) { status = organizationBll.Create(organization); if (status == true) { ViewBag.Msg = "Organization Successfully Added"; ModelState.Clear(); return(View()); } if (status == false) { ViewBag.Msg = "Organization Added Failed"; } } return(View(organization)); }