public ActionResult Update(Organization organization, HttpPostedFileBase ImageFile, byte[] CurrentImage)
        {
            if (ImageFile == null)
            {
                organization.Image = CurrentImage;
            }

            if (ImageFile != null)
            {
                bool isValidFormat = common.CheckImageFormat(ImageFile);
                if (isValidFormat == false)
                {
                    organization.Image = CurrentImage;
                    ModelState.AddModelError("Image", "Only jpg , png , jpeg are allowed");
                }
                else
                {
                    organization.Image = common.ConvertImage(ImageFile);
                }
            }

            if (ModelState.IsValid)
            {
                status = organizationBll.Update(organization);
                if (status == true)
                {
                    return(RedirectToAction("ShowAll"));
                }
                if (status == false)
                {
                    ViewBag.Msg = "Organization Category Added Failed";
                }
            }
            return(View(organization));
        }
Example #2
0
        public ActionResult OrgEdit(Organization organization)
        {
            //var model = Mapper.Map<Course>(CourseCV);

            var isSave = _organizationBll.Update(organization);

            if (isSave)
            {
                ViewBag.Smsg = "Saved Successfully.";
            }
            else
            {
                ViewBag.Emsg = "Failed...";
            }


            return(View(organization));
        }