public IResult <SalesArticleSerialNumberDetails> GetSerialNumberDetails(string articleNumber)
        {
            var salesArticleResponseModel = this.salesArticleRepository.FindById(articleNumber);

            if (salesArticleResponseModel == null)
            {
                return(new NotFoundResult <SalesArticleSerialNumberDetails>($"Could not find Sales Article {articleNumber}"));
            }

            string sernosGroup;

            try
            {
                sernosGroup = this.sernosPack.GetProductGroup(articleNumber);
            }
            catch (Exception e)
            {
                return(new BadRequestResult <SalesArticleSerialNumberDetails>(e.Message));
            }

            var salesArticleSerialNumberDetails = new SalesArticleSerialNumberDetails
            {
                SerialNumberType = salesArticleResponseModel.TypeOfSerialNumber,
                SernosGroup      = sernosGroup
            };

            return(new SuccessResult <SalesArticleSerialNumberDetails>(salesArticleSerialNumberDetails));
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            this.salesArticleSerialNumberDetails = new SalesArticleSerialNumberDetails
            {
                SernosGroup      = "group",
                SerialNumberType = "P1"
            };
            this.SalesArticleSerialNumberFacadeService.GetSerialNumberDetails("A").Returns(
                new SuccessResult <SalesArticleSerialNumberDetails>(this.salesArticleSerialNumberDetails));

            this.Response = this.Browser.Get(
                "/products/maint/sales-articles/serial-number-details/A",
                with =>
            {
                with.Header("Accept", "application/json");
            }).Result;
        }