/// <summary> /// /// </summary> /// <param name="content"></param> /// <returns></returns> public async Task PutContentAsync(KpiAdditionalContentContract content) { var existing = await Context.KpiAdditionalContents.FindAsync(content.Id); if (existing == null) { throw new CannotFindIdException("content", content.Id); } var updated = KPIDashboardMapper.AdditionalContentContractToEntity(content); Context.Entry(existing).CurrentValues.SetValues(updated); Context.Entry(existing).State = EntityState.Modified; if (await Context.SaveChangesAsync() <= 0) { throw new CannotSaveToDatabaseException("content"); } }