Пример #1
0
        public async Task <IHttpActionResult> AddMultipleItems(List <oItem> items)
        {
            try
            {
                if (!GlobalInstance.Instance.IsConnected)
                {
                    GlobalInstance.Instance.InitializeSboComObject();
                }

                if (repo.AddMultiple(items) < 0)
                {
                    errMsg = GlobalInstance.Instance.SBOErrorMessage;
                    var resp = new HttpResponseMessage(HttpStatusCode.Conflict);
                    resp.Content      = new StringContent(errMsg);
                    resp.ReasonPhrase = "SBO Error";
                    throw new HttpResponseException(resp);
                }

                return(Ok("Successfully added items."));
            }
            catch (HttpResponseException ex)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }
        }