public JsonResult SaveBannerTR(Banner banner) { foreach (var prop in banner.GetType().GetProperties()) { if (banner.GetType().GetProperty(prop.Name).GetValue(banner, null) == null) { banner.GetType().GetProperty(prop.Name).SetValue(banner, "", null); } } DBI dbi = new DBI(); string[] parameters = { "@ID", "@Slot", "@Duration", "@Title", "@TopImage", "@TopImageUrl", "@TopImageWidth", "@FirstCaption", "@FirstCaptionSize", "@SecondCaption", "@SecondCaptionSize", "@BannerImage", "@BannerImageUrl", "@BannerImageWidth", "@ButtonText", "@ButtonUrl", "@OnAir" }; object[] values = { banner.ID, banner.Slot, banner.Duration, banner.Title, banner.TopImage, banner.TopImageUrl, banner.TopImageWidth, banner.FirstCaption, banner.FirstCaptionSize, banner.SecondCaption, banner.SecondCaptionSize, banner.BannerImage, banner.BannerImageUrl, banner.BannerImageWidth, banner.ButtonText, banner.ButtonUrl, banner.OnAir }; try { dbi.ExecuteWithParameters(new Procedure("pacetrSaveBanner", parameters, values)); return(Json("S", JsonRequestBehavior.AllowGet)); } catch (System.Exception ex) { return(Json("F", JsonRequestBehavior.AllowGet)); } }