public async Task <IActionResult> PostContext([FromBody] RevisedStockPrice param) { if (await context.RevisedStockPrices.AnyAsync(o => o.Code.Equals(param.Code) && o.Date.Equals(param.Date))) { context.Entry(param).State = EntityState.Modified; } else { context.RevisedStockPrices.Add(param); } await context.BulkSaveChangesAsync(); return(Ok()); }
public async Task <IActionResult> PostContext(string key, [FromBody] RevisedStockPrice param) { if (await context.Privacies.AnyAsync(o => o.Security.Equals(Security.GetGrantAccess(key)))) { if (await context.RevisedStockPrices.AnyAsync(o => o.Code.Equals(param.Code) && o.Date.Equals(param.Date))) { context.Entry(param).State = EntityState.Modified; } else { context.RevisedStockPrices.Add(param); } await context.BulkSaveChangesAsync(); return(Ok()); } return(BadRequest()); }