예제 #1
0
        public async Task <GetTemporaryProduct> GetTemporaryProductForEdit(NullableIdDto input)
        {
            if (input.Id == null)
            {
                input.Id = 0;
            }
            var output = new GetTemporaryProduct();
            var query  = _TempProductRepository
                         .GetAll().Where(p => p.Id == input.Id);

            if (query.Count() > 0)
            {
                output.TemporaryProductLists = query.FirstOrDefault().MapTo <TemporaryProductList>();

                var Images = (from c in _TempProductImageRepository.GetAll()
                              where c.TemporaryProductId == input.Id
                              select new TemporaryProdImages
                {
                    Id = c.Id,
                    ImageUrl = c.ImageUrl
                }).ToArray();

                output.TempProductImages = Images;
            }

            return(output);
        }
예제 #2
0
        public async Task <GetTemporaryProduct> GetTemporaryProductForEditBySuspectCode(SuspectCodeSearch input)
        {
            var output = new GetTemporaryProduct();
            var query  = _TempProductRepository
                         .GetAll().Where(p => p.SuspectCode == input.SuspectCode).FirstOrDefault();

            if (query != null)
            {
                output.TemporaryProductLists = query.MapTo <TemporaryProductList>();

                var Images = (from c in _TempProductImageRepository.GetAll()
                              where c.TemporaryProductId == query.Id
                              select new TemporaryProdImages
                {
                    Id = c.Id,
                    ImageUrl = c.ImageUrl
                }).ToArray();

                output.TempProductImages = Images;
            }

            return(output);
        }