public RetryOrg Add(RetryOrg newRetryOrg) { if (_context.RetryOrgs.Any(r => r.Geo == newRetryOrg.Geo && r.OrganizationId == newRetryOrg.OrganizationId)) { return(Update(newRetryOrg)); } else { _context.RetryOrgs.Add(newRetryOrg); _context.SaveChanges(); } return(newRetryOrg); }
public RetryOrg Update(RetryOrg newRetryOrg) { // Update only if the timestamp is updated or the solutionVersion var previousData = Get(newRetryOrg.Geo, newRetryOrg.OrganizationId); if (previousData == null) { return(newRetryOrg); } if (previousData.PreciseTimeStamp < newRetryOrg.PreciseTimeStamp || previousData.SolutionVersion != newRetryOrg.SolutionVersion) /// TODO: Room for improvements { _context.Attach(newRetryOrg).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); } return(newRetryOrg); }
public void Post([FromBody] JObject value) { RetryOrg retryOrg = JsonConvert.DeserializeObject <RetryOrg>(value.ToString(Formatting.None)); _retryOrgData.Add(retryOrg); }