// ONLY access localTableCopy and not the localTable, to prevent races, as this method may be called outside the turn. internal SiloStatus GetApproximateSiloStatus(SiloAddress siloAddress) { var status = SiloStatus.None; if (siloAddress.Equals(MyAddress)) { status = CurrentStatus; } else { if (!localTableCopy.TryGetValue(siloAddress, out status)) { if (CurrentStatus.Equals(SiloStatus.Active)) { if (logger.IsVerbose) { logger.Verbose(ErrorCode.Runtime_Error_100209, "-The given siloAddress {0} is not registered in this MembershipOracle.", siloAddress.ToLongString()); } } status = SiloStatus.None; } } if (logger.IsVerbose3) { logger.Verbose3("-GetApproximateSiloStatus returned {0} for silo: {1}", status, siloAddress.ToLongString()); } return(status); }
// To protect from overposting attacks, enable the specific properties you want to bind to. // For more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Order.UpdatedAt = DateTime.Now; HttpClient client = _api.Initial(); HttpResponseMessage res = await client.PutAsync("api/Orders/" + Order.ID, new StringContent( JsonConvert.SerializeObject(Order), Encoding.UTF8, MediaTypeNames.Application.Json)); if (res.IsSuccessStatusCode) { if (!CurrentStatus.Equals(Order.Status)) { _orderLogger.Info("Payment ID : {payment_id}, Order status has been changed from {current_status} >> {new_status}.", Order.PaymentID, CurrentStatus, Order.Status); } _logger.LogInformation("{user} has edited this order [ID: {order_id}].", HttpContext.User.Identity.Name, Order.ID); return(RedirectToPage("./Index")); } ViewData["Error"] = "Failed to edit record"; return(Page()); }