public object Post(Models.QuoteDetail added) { object json; string messageError = ""; try { Models.QuoteDetail posted = repository.AddDetail(added, ref messageError); if (posted != null) { json = new { total = 1, data = posted, success = true }; } else { json = new { message = messageError, success = false }; }; } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); object error = new { message = ex.Message }; json = new { message = ex.Message, success = false }; }; return(json); }