public ResponseModel <ClientsModel> GetById(int id) { var resp = new ResponseModel <ClientsModel>(); try { IClientsRepository appRepo = new ClientsRepository(new DataBaseContext()); var app = appRepo.GetClientsModelById(id); if (app != null) { resp.Data = app; resp.Status = 200; resp.Description = "OK"; } else { resp.Status = 200; resp.Data = null; resp.Description = "Application not found"; } } catch (Exception ex) { resp.Status = 500; resp.Description = $"Error: {ex.Message}"; resp.Data = null; } return(resp); }
public static string GetClientName(int id) { IClientsRepository repo = new ClientsRepository(new DataBaseContext()); return(repo.GetClientsModelById(id)?.Name ?? string.Empty); }
public static ClientsModel GetClient(int id) { IClientsRepository repo = new ClientsRepository(new DataBaseContext()); return(repo.GetClientsModelById(id)); }