Example #1
0
 public AddSupplierView(SupplierModel model, HomeViewModel home_view_model)
 {
     InitializeComponent();
     this.AddSupplierViewModel = new AddSupplierViewModel(model, this, home_view_model);
     this.DataContext          = AddSupplierViewModel;
     this.Owner = Application.Current.MainWindow;
     first_name_text_box.Focus();
     CoreApp.logger.log("AddSupplierView successfully initialized!");
 }
        public async Task <IActionResult> AddSupplier([FromBody] AddSupplierViewModel addSupplierViewModel)
        {
            var res = await _supplierServiceAdmin.Add(addSupplierViewModel);

            if (res == 0)
            {
                return(BadRequest());
            }
            return(Ok(res));
        }
        public IActionResult AddSupplier(AddSupplierViewModel model)
        {
            var newSupplier = new Supplier()
            {
                CompanyName       = model.CompanyName,
                BankAccountNumber = model.BankAccountNumber,
                Street            = model.Street,
                ZipCode           = model.ZipCode,
                City = model.City
            };

            _repo.AddSupplier(newSupplier);

            return(RedirectToAction("Suppliers"));
        }
Example #4
0
        public void AddSupplier(AddSupplierViewModel addSupplier)
        {
            var supplier = new Supplier
            {
                SupplierName       = addSupplier.SupplierName,
                SupplierPostalCode = addSupplier.SupplierPostalCode,
                SupplierAddress    = addSupplier.SupplierAddress,
                SupplierCountry    = addSupplier.SupplierCountry,
                Email       = addSupplier.Email,
                PhoneNumber = addSupplier.PhoneNumber,
                SupplierAdditionalInformation = addSupplier.SupplierAdditionalInformation,
                CustomsAuthorisationNeeded    = addSupplier.CustomsAuthorisationNeeded,
            };

            this.dbContext.Suppliers.Add(supplier);
            this.dbContext.SaveChanges();
        }
Example #5
0
        public IActionResult Add(AddSupplierViewModel addSupplierViewModel)
        {
            if (ModelState.IsValid)
            {
                // Add the new supplier to the list of suppliers
                Supplier newSupplier = new Supplier
                {
                    Name    = addSupplierViewModel.Name,
                    Country = addSupplierViewModel.Country
                };

                context.Suppliers.Add(newSupplier);
                context.SaveChanges();

                return(Redirect("/Supplier"));
            }

            return(View(addSupplierViewModel));
        }
Example #6
0
        public async Task <int> Add(AddSupplierViewModel addSupplierViewModel)
        {
            try
            {
                Supplier supplier = new Supplier()
                {
                    Name    = addSupplierViewModel.Name,
                    Address = addSupplierViewModel.Address,
                    Email   = addSupplierViewModel.Email,
                    Phone   = addSupplierViewModel.Phone,
                    Status  = addSupplierViewModel.Status
                };
                _daxoneDBContext.Suppliers.Add(supplier);
                int res = await _daxoneDBContext.SaveChangesAsync();

                return(res);
            }
            catch (Exception)
            {
                return(-1);
            }
        }
Example #7
0
 public AddSupplierWindow()
 {
     InitializeComponent();
     this.DataContext = addSupplierViewModel = new AddSupplierViewModel();
 }
Example #8
0
        public IActionResult Add()
        {
            AddSupplierViewModel addSupplierViewModel = new AddSupplierViewModel();

            return(View(addSupplierViewModel));
        }