private void UpdateDocument_Type() { using (var ctx = new Document_TypeClient()) { var dto = ctx.GetDocument_Type().Result.FirstOrDefault(x => x.Document_TypeId == this.Document_TypeId); if (dto != null) { Document_Type = new Document_Type(dto); } } }
public async Task <Document_Type> CreateDocument_Type(Document_Type entity) { try { using (var t = new Document_TypeClient()) { return(new Document_Type(await t.CreateDocument_Type(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 <Document_Type> UpdateDocument_Type(Document_Type entity) { if (entity == null) { return(entity); } var entitychanges = entity.ChangeTracker.GetChanges().FirstOrDefault(); if (entitychanges != null) { try { using (var t = new Document_TypeClient()) { var updatedEntity = await t.UpdateDocument_Type(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); } }