Exemplo n.º 1
0
        public async Task EditAsync(DeliveryTaxViewModel viewModel)
        {
            var tax = this.ExistTaxById(viewModel.Id);

            tax.Price       = viewModel.Price;
            tax.MistralCode = viewModel.MistralCode;
            tax.MistralName = viewModel.MistralName;
            this.deliveryTaxRepository.Update(tax);
            await this.deliveryTaxRepository.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(DeliveryTaxViewModel viewModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(viewModel));
            }

            try
            {
                await this.deliveryTaxService.EditAsync(viewModel);

                return(this.RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                this.logger.LogInformation(GlobalConstants.DefaultLogPattern, this.User.Identity.Name, e.Message, e.StackTrace);
                return(this.NotFound());
            }
        }