public ActionResult Edit(Supplier Supplier, HttpPostedFileBase ImageFile) { if (ImageFile != null) { bool isValidFormate = common.ImageValidation(ImageFile); if (isValidFormate == false) { ModelState.AddModelError("Image", "only png,jpeg,jpg formates are allowed"); } byte[] convertedImage = common.ConvertImage(ImageFile); Supplier.Image = convertedImage; } if (ModelState.IsValid) { status = _supplierBll.Edit(Supplier); if (status == true) { return(RedirectToAction("List", "Suppliers")); } else { ViewBag.Message = "Item is not updated succesfully"; } } return(View(Supplier)); }