private async Task Create(LocalSubSubsidiaries coaLocal) { var response = _client.PostAsJsonAsync("api/coa", new CoaControlPostRequestBody { desc = coaLocal.Name, name = coaLocal.Name, parent = coaLocal.SubsidiaryRefNo }).Result; response.EnsureSuccessStatusCode(); var contents = await response.Content.ReadAsAsync <CoaControlPostResponse>(); coaLocal.RefNo = contents._id; using (var context = new TMSEntities()) { var SubSubsidiaries = context.COASubSubsidiaries.FirstOrDefault(w => w.ControlCode == coaLocal.ControlCode && w.SubSubsidiaryCode == coaLocal.SubSubsidiaryCode && w.GeneralCode == coaLocal.GeneralCode && w.SubsidiaryCode == coaLocal.SubsidiaryCode); if (SubSubsidiaries != null) { SubSubsidiaries.RefNo = contents._id; SubSubsidiaries.UpdatedOn = DateTime.Now; } context.SaveChanges(); } }
public void Save() { db.SaveChanges(); }