private Contexts.ServerInfo FindById(string id) { Contexts.ServerInfo result = null; try { result = dbContext.ServerInfo.FirstOrDefault(x => x.Id == id); } catch (Exception) { } return(result); }
public async Task <bool> Add(Contexts.ServerInfo model) { var result = false; try { dbContext.ServerInfo.Add(model); await dbContext.SaveChangesAsync(); result = true; } catch (Exception) { } return(result); }
public async Task <bool> Update(string id, Contexts.ServerInfo model) { var result = false; try { var value = dbContext.ServerInfo.FirstOrDefault(x => x.Id == id); if (value != null) { value.key_str = model.key_str; value.value_str = model.value_str; await dbContext.SaveChangesAsync(); result = true; } } catch (Exception) { } return(result); }