public ActionResult Insert(string name, string minified_desc, string desc, System.Web.HttpPostedFileWrapper image, string price, string services) { if (!Authentication.IsValid()) { return(Json(new { Error = "Not Authenticated" })); } string base64Image = null; if (image != null) { BinaryReader br = new BinaryReader(image.InputStream); byte[] bytes = br.ReadBytes((Int32)image.InputStream.Length); base64Image = Convert.ToBase64String(bytes); } PackageDAO.Insert(name, minified_desc, desc, base64Image, price, services); Package p = PackageDAO.GetByName(name); return(Json(new { p.Id, Package = CustomHtmlHelper.CustomHtmlHelper.RenderPartialToString("Profile/TableItem/_Package", p, ControllerContext) })); }