Ejemplo n.º 1
0
        public IHttpActionResult GatherAllData([FromBody] BulkDataModel bulkData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (bulkData == null)
            {
                var msg = new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    ReasonPhrase = "Data is null"
                };
                throw new HttpResponseException(msg);
            }

            string connectionString = ConfigurationManager.ConnectionStrings["SilentConnection"].ConnectionString;
            string sqlResponse      = SqlHelper.GatherData(connectionString, Base64Helper.DecodeBulk(bulkData));

            if (sqlResponse == "")
            {
                return(Ok());
            }
            else
            {
                if (sqlResponse.Equals("Authentication failed"))
                {
                    //var msg = new HttpResponseMessage(HttpStatusCode.Unauthorized) { ReasonPhrase = "Authentication failed" };
                    //throw new HttpResponseException(msg);
                }
                return(Ok());
            }
        }