Beispiel #1
0
        public List <object> BulkImport(string schemaName, string tableName, [FromBody] JArray collection)
        {
            var userCollection = this.ParseCollection(collection);

            if (userCollection == null || userCollection.Count.Equals(0))
            {
                return(null);
            }

            try
            {
                var repository = new FormRepository(schemaName, tableName, this.MetaUser.Tenant, this.MetaUser.LoginId, this.MetaUser.UserId);
                return(repository.BulkImport(userCollection));
            }
            catch (UnauthorizedException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (DataAccessException ex)
            {
                throw new HttpResponseException(new HttpResponseMessage
                {
                    Content    = new StringContent(ex.Message),
                    StatusCode = HttpStatusCode.InternalServerError
                });
            }
#if !DEBUG
            catch
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
#endif
        }