public ResultCode ModifyBuyer( Buyer _oBuyer ) { if (String.IsNullOrEmpty(ServiceEndPoint)) throw new Exception("Missing Service Endpoint in Context"); string szResponseResult = ProcessServiceRequest("buyers/modify", "PUT", Helper.Serialize<Buyer>(_oBuyer)); return Helper.Deserialize<ResultCode>(szResponseResult); }
public ResultCode ModifyBuyer(Buyer _oBuyer) { try { for (int i = 0; i < Buyers.Count; i++) { if (Buyers[i].ID == _oBuyer.ID) { Buyers[i] = _oBuyer; break; } } SaveAHData(); return new ResultCode() { Code = 0, ContextID = _oBuyer.ID, Message = "Success" }; } catch (Exception exc) { // TODO register error return new ResultCode() { Code = -1, ContextID = String.Empty, Message = "EXC: " + exc.Message }; } }
public ResultCode AddBuyer(Buyer _oBuyer) { try { for (int i = 0; i < Buyers.Count; i++) { if (String.Compare(Buyers[i].Username, _oBuyer.Username, true) == 0) { // TODO map error code return new ResultCode() { Code = -2, ContextID = String.Empty, Message = "Username already used" }; } } Buyers.Add(_oBuyer); SaveAHData(); return new ResultCode() { Code = 0, ContextID = _oBuyer.ID, Message = "Success" }; } catch (Exception exc) { // TODO register error return new ResultCode() { Code = -1, ContextID = String.Empty, Message = "EXC: " + exc.Message }; } }