public async Task AddAsync(DeliveryTaxInpitModel inputModel) { await this.deliveryTaxRepository.AddAsync( new DeliveryTax() { Price = inputModel.Price, MistralCode = inputModel.MistralCode, MistralName = inputModel.MistralName, }); await this.deliveryTaxRepository.SaveChangesAsync(); }
public async Task <IActionResult> Add(DeliveryTaxInpitModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } try { await this.deliveryTaxService.AddAsync(inputModel); return(this.RedirectToAction("Index")); } catch (Exception e) { this.logger.LogInformation(GlobalConstants.DefaultLogPattern, this.User.Identity.Name, e.Message, e.StackTrace); return(this.NotFound()); } }