Exemplo n.º 1
0
        public ActionResult Update(Party party, HttpPostedFileBase ImageFile, byte[] CurrentImage)
        {
            if (ImageFile == null)
            {
                party.Image = CurrentImage;
            }

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

            if (ModelState.IsValid)
            {
                status = partyBll.Update(party);
                if (status == true)
                {
                    return(RedirectToAction("ShowAll"));
                }
                if (status == false)
                {
                    ViewBag.Msg = "Party Category Added Failed !";
                }
            }
            return(View(party));
        }