Exemple #1
0
        public ActionResult Edit(Customer Customer, 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);
                Customer.Image = convertedImage;
            }

            if (ModelState.IsValid)
            {
                status = _customerBll.Edit(Customer);
                if (status == true)
                {
                    return(RedirectToAction("List", "Customers"));
                }
                else
                {
                    ViewBag.Message = "Item is not updated succesfully";
                }
            }
            return(View(Customer));
        }