Ejemplo n.º 1
0
        public Task <Article> HandleAsync(MatchArticlePayload input, ExternalTask task)
        {
            var article = _service.MatchUnfinishedArticleByGtinAndBundle(input.NoteId, input.Gtin, input.BundleId);

            string faultReason = null;

            if (article == null)
            {
                faultReason = "absent in delivery";
            }
            else if (article.IsSuspended)
            {
                faultReason = "suspended";
            }
            else if (!article.IsUnfinished)
            {
                faultReason = "completed";
            }

            if (faultReason != null)
            {
                return(Task.FromException <Article>(
                           new SelectedBundleNotAvailable(input.NoteId, input.BundleId, faultReason)
                           ));
            }

            return(Task.FromResult(article));
        }
        public Task <Article> HandleAsync(MatchArticlePayload input, ExternalTask task)
        {
            var article = _service.MatchUnfinishedArticleByGtinAndBundle(input.NoteId, input.Gtin, int.Parse(input.BundleId));

            return(Task.FromResult(article));
        }