예제 #1
0
        public ViewResult New(int?id)
        {
            var product = new ProductAddEditVM();

            if (id != null)
            {
                product = _ProductRepository.Get((int)id).toProductAddEditVM();
            }
            var types = _ProductTypeRepository.FindAll();

            ViewBag.Types = types;
            return(View(product));
        }
예제 #2
0
        public async Task <ServiceResponse> Get(int idProduct)
        {
            var sr = new ServiceResponse();

            try
            {
                sr.Data = _mapper.Map <ProductDto>(await _repositoryProduct.Get(idProduct));
            }
            catch (Exception ex)
            {
                sr.AddError(ex);
            }

            return(sr);
        }