コード例 #1
0
ファイル: CodeExtension.cs プロジェクト: iqbal001001/PDSAPI
        public static ProductCode ToDomain(this ProductCodeDto code, ProductCode originalCode = null)
        {
            if (originalCode != null && originalCode.Id == code.Id)
            {
                originalCode.Name            = code.Name;
                originalCode.Code            = code.Code;
                originalCode.Excess          = code.Excess;
                originalCode.HospitalRanking = code.HospitalRanking;
                originalCode.ExtrasRanking   = code.ExtrasRanking;

                ((IDataDto)code).ToDomain((IData)originalCode);
                return(originalCode);
            }

            var data = new ProductCode
            {
                Name            = code.Name,
                Code            = code.Code,
                Excess          = code.Excess,
                HospitalRanking = code.HospitalRanking,
                ExtrasRanking   = code.ExtrasRanking
            };

            ((IDataDto)code).ToDomain((IData)data);
            return(data);
        }
コード例 #2
0
ファイル: CodeExtension.cs プロジェクト: iqbal001001/PDSAPI
        public static ProductCodeDto ToDto(this ProductCode code)
        {
            code.Ancillaries?.ForEach(v => v.ProdutCodeId = code.Id);
            var dto = new ProductCodeDto
            {
                Id              = code.Id,
                UniqueId        = Guid.NewGuid(),
                Name            = code.Name,
                Code            = code.Code,
                Excess          = code.Excess,
                HospitalRanking = code.HospitalRanking,
                ExtrasRanking   = code.ExtrasRanking,
                Ancillaries     = code.Ancillaries?.Select(v => v.ToDto()).ToList()
            };

            ((IData)code).ToDto((IDataDto)dto);
            return(dto);
        }
コード例 #3
0
        public ResponseDto Save(ProductCodeDto saveDto)
        {
            ResponseDto responseDto = new ResponseDto();

            ProductCodeBo saveBo = new ProductCodeBo()
            {
                Code = saveDto.Code,
                ProductCodeTypeId = saveDto.ProductCodeTypeId,

                ProductId = saveDto.ProductId,

                Session = Session
            };

            ResponseBo responseBo = productCodeBusiness.Save(saveBo);

            responseDto = responseBo.ToResponseDto();

            return(responseDto);
        }
コード例 #4
0
        public void Post()
        {
            try
            {
                using (var server = TestServer.Create <MyStartup>())
                {
                    var dto = new ProductCodeDto
                    {
                        Id   = 0,
                        Name = "Product Suite 1",
                        Code = "AH2"
                    };

                    HttpResponseMessage response;
                    response = server.HttpClient.PostAsJsonAsync("api/ProductCode", dto).Result;
                }
            }
            catch (Exception ex)
            {
            }
        }