public async Task <ExternalSystemDbo> AddOrUpdate(ExternalSystemDbo externalSystem) { try { Log.Debug($"{nameof(AddOrUpdate)} called on {nameof(ExternalSystemRepository)}"); _context.ExternalSystems.Update(externalSystem); externalSystem.Id = await _context.SaveChangesAsync(); Log.Debug($"ExternalSystem saved in method {nameof(AddOrUpdate)} called on {nameof(ExternalSystemRepository)}"); } catch (Exception ex) { Debug.WriteLine(ex); Log.Error($"Error in method {nameof(AddOrUpdate)} in {nameof(ExternalSystemRepository)}"); } return(externalSystem); }
public async Task <ExternalSystemDbo> Get(int id) { ExternalSystemDbo item = null; try { Log.Debug($"{nameof(Get)} called on {nameof(ExternalSystemRepository)} with param id of \"{id}\""); item = await _context.ExternalSystems.FirstOrDefaultAsync(x => x.Id == id); Log.Debug($"{(item == null ? "0" : "1")} item(s) was found in {nameof(ExternalSystemRepository)} for id \"{id}\""); } catch (Exception ex) { Debug.WriteLine(ex); Log.Error($"Error in method {nameof(Get)} in {nameof(ExternalSystemRepository)}", ex); } return(item); }