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