Beispiel #1
0
        public async Task UpdateProduct(CreateOrUpdateProductInput input)
        {
            Debug.Assert(input.Id != null, "input.Product.Id should be set.");

            //var product = await _productRepository.GetAsync(input.Id.Value);
            var product = input.MapTo <Product>();
            await _productRepository.UpdateAsync(product);
        }
Beispiel #2
0
 /// <summary>
 /// 1.增改
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task CreateOrUpdateProduct(CreateOrUpdateProductInput input)
 {
     if (input.Id.HasValue && input.Id != 0)
     {
         await UpdateProduct(input);
     }
     else
     {
         await CreateProduct(input);
     }
 }
Beispiel #3
0
        //TODO:2018/12/3
        public CreateOrUpdateProductInput GetProductForEdit(NullableIdInput input)
        {
            var product = new Product();

            if (input.Id.HasValue)
            {
                //Editing an existing person
                product = _productRepository.Get(input.Id.Value);
            }

            var output = new CreateOrUpdateProductInput();

            //Person
            output = product != null
                ? product.MapTo <CreateOrUpdateProductInput>()
                : new CreateOrUpdateProductInput();

            return(output);
        }
Beispiel #4
0
        //[AbpAuthorize("Administration.ProductManagement.CreateProduct")]
        /// <summary>
        /// 2.增加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task CreateProduct(CreateOrUpdateProductInput input)
        {
            var product = input.MapTo <Product>();

            await _productRepository.InsertAsync(product);
        }