private void UpdateCustoms_Procedure() { using (var ctx = new Customs_ProcedureClient()) { var dto = ctx.GetCustoms_Procedure().Result.FirstOrDefault(x => x.Customs_ProcedureId == this.Customs_ProcedureId); if (dto != null) { Customs_Procedure = new Customs_Procedure(dto); } } }
public async Task <Customs_Procedure> CreateCustoms_Procedure(Customs_Procedure entity) { try { using (var t = new Customs_ProcedureClient()) { return(new Customs_Procedure(await t.CreateCustoms_Procedure(entity.DTO).ConfigureAwait(continueOnCapturedContext: false))); } } catch (FaultException <ValidationFault> e) { throw new Exception(e.Detail.Message, e.InnerException); } catch (Exception) { Debugger.Break(); throw; } }
public async Task <Customs_Procedure> UpdateCustoms_Procedure(Customs_Procedure entity) { if (entity == null) { return(entity); } var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault(); if (entitychanges != null) { try { using (var t = new Customs_ProcedureClient()) { var updatedEntity = await t.UpdateCustoms_Procedure(entitychanges).ConfigureAwait(false); entity.EntityId = updatedEntity.EntityId; entity.DTO.AcceptChanges(); //var = entity.; //entity.ChangeTracker.MergeChanges(,updatedEntity); //entity. = ; return(entity); } } catch (FaultException <ValidationFault> e) { throw new Exception(e.Detail.Message, e.InnerException); } catch (Exception) { Debugger.Break(); throw; } } else { return(entity); } }