示例#1
0
        /// <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."));
            }
        }
示例#2
0
        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."));
            }
        }
示例#3
0
 static SqlMapper()
 {
     sqlServer = DataMapperProvider.Build("SqlConfig.xml", Assembly.GetExecutingAssembly(), "connectionString");
 }
示例#4
0
 public static void Init()
 {
     _Default = DataMapperProvider.Build("SqlConfig.xml", Assembly.GetExecutingAssembly(), "ConnectionString");
 }