/// <summary> /// Get clients. /// </summary> /// <returns></returns> public HttpResponseMessage Get(int clientId) { try { var clients = ClientSchedulerModel.Clients .Select(r => r) .ToList(); var result = new List <ClientModel>(); foreach (var client in clients) { result.Add(DataMapperProvider.MapEntityToModel <DAL.Client, ClientModel>(client)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception ex) { // Log Exception return(Request.CreateResponse(HttpStatusCode.NotFound, "No Clients found in the system due to an unexpected error.")); } }
public HttpResponseMessage GetV2(int clientId) { try { var client = ClientSchedulerModel.Clients .FirstOrDefault(r => r.ClientId == clientId); return(Request.CreateResponse(HttpStatusCode.OK, DataMapperProvider.MapEntityToModel <DAL.Client, ClientModel>(client))); } catch (Exception ex) { // Log Exception return(Request.CreateResponse(HttpStatusCode.NotFound, "No Clients found in the system due to an unexpected error.")); } }
static SqlMapper() { sqlServer = DataMapperProvider.Build("SqlConfig.xml", Assembly.GetExecutingAssembly(), "connectionString"); }
public static void Init() { _Default = DataMapperProvider.Build("SqlConfig.xml", Assembly.GetExecutingAssembly(), "ConnectionString"); }