Exemplo n.º 1
0
        public ActionResult Edit(Employee employee, 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);
                employee.Image = convertedImage;
            }

            if (ModelState.IsValid)
            {
                status = employeeBll.Edit(employee);
                if (status == true)
                {
                    return(RedirectToAction("List", "Employees"));
                }
                else
                {
                    ViewBag.Message = "Item is not updated succesfully";
                }
            }
            ViewBag.OutletId    = employeeBll.GetOutlet();
            ViewBag.ReferenceId = employeeBll.GetReference();
            return(View(employee));
        }