public ActionResult SaveShadeCard() { ShadeCard oShadeCard = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <ShadeCard>(Request["objShadeCard"]); bool Add_Flag = new CommonBL().isNewEntry(oShadeCard.ShadeId); try { if (Request.Files != null && Request.Files.Count > 0) { using (var binaryReader = new BinaryReader(Request.Files[0].InputStream)) oShadeCard.ShadeImage = SiteUtility.ResizeImage(binaryReader.ReadBytes(Request.Files[0].ContentLength), 200, 50); } else if (oShadeCard.ShadeId != 0) { oShadeCard.ShadeImage = new ShadeCardBL().GetById(oShadeCard.ShadeId).ShadeImage; } oShadeCard.ModifiedBy = oUser.Email; oShadeCard.ModifiedOn = DateTime.UtcNow; if (Add_Flag) { new ShadeCardBL().Create(oShadeCard); } else { new ShadeCardBL().Update(oShadeCard); } return(Json(new { success = true, message = CommonMsg.Success(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) })); } catch (Exception ex) { return(Json(new { success = false, message = CommonMsg.Fail(EntityNames.Shade, Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update) })); } }