public object Put(CustomsClearence updated) { object json; try { CustomsClearence putting = repository.Update(updated); json = new { total = 1, data = putting, success = true }; } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); json = new { message = ex.Message, success = false }; }; return(json); }
public object Delete(CustomsClearence deleted) { object json; try { bool result = repository.Remove(deleted); json = new { success = result }; } catch (Exception ex) { json = new { success = false, message = ex.Message }; } return(json); }
public object Post(CustomsClearence added) { object json; try { CustomsClearence posted = repository.Add(added); if (posted != null) { json = new { total = 1, data = posted, success = true }; } else { json = new { success = false }; }; } catch (Exception ex) { LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message); json = new { message = ex.Message, success = false }; }; return(json); }