public IActionResult EditCustomer(int id)
        {
            CustomerEditVievModel tempCustomerEditVievModel = new CustomerEditVievModel();
            var tempCustomer = _context.Customerses.Single(x => x.Id == id);

            tempCustomerEditVievModel.Citi           = tempCustomer.Citi;
            tempCustomerEditVievModel.Email          = tempCustomer.EmailOfCustomer;
            tempCustomerEditVievModel.NIP            = tempCustomer.NIP;
            tempCustomerEditVievModel.NameOfComany   = tempCustomer.NameOfComany;
            tempCustomerEditVievModel.NameOfCustomer = tempCustomer.NameOfCustomer;
            tempCustomerEditVievModel.PhoneNumber    = tempCustomer.PhoneNumber;
            tempCustomerEditVievModel.Street         = tempCustomer.PhoneNumber;
            tempCustomerEditVievModel.Id             = tempCustomer.Id;
            return(View(tempCustomerEditVievModel));
        }
        public IActionResult CustomerDane()
        {
            CustomerEditVievModel tempCustomerEditVievModel = new CustomerEditVievModel();
            var tempUsrer = HttpContext.User.Identity.Name;
            var temp3     = _context.UserModels.Where(x => x.UserName == tempUsrer)
                            .Select(i => i.CustomersID).ToArray();
            var tempCustomer = _context.Customerses.Single(x => x.Id == temp3[0]);

            tempCustomerEditVievModel.Citi           = tempCustomer.Citi;
            tempCustomerEditVievModel.Email          = tempCustomer.EmailOfCustomer;
            tempCustomerEditVievModel.NIP            = tempCustomer.NIP;
            tempCustomerEditVievModel.NameOfComany   = tempCustomer.NameOfComany;
            tempCustomerEditVievModel.NameOfCustomer = tempCustomer.NameOfCustomer;
            tempCustomerEditVievModel.PhoneNumber    = tempCustomer.PhoneNumber;
            tempCustomerEditVievModel.Street         = tempCustomer.PhoneNumber;
            tempCustomerEditVievModel.Id             = tempCustomer.Id;
            return(View(tempCustomerEditVievModel));
        }
        public IActionResult EditCustomer(CustomerEditVievModel customerEditVievModel)
        {
            Customers tempCustomers = new Customers();

            tempCustomers.Id              = customerEditVievModel.Id;
            tempCustomers.Citi            = customerEditVievModel.Citi;
            tempCustomers.EmailOfCustomer = customerEditVievModel.Email;
            tempCustomers.NIP             = customerEditVievModel.NIP;
            tempCustomers.NameOfComany    = customerEditVievModel.NameOfComany;
            tempCustomers.NameOfCustomer  = customerEditVievModel.NameOfCustomer;
            tempCustomers.PhoneNumber     = customerEditVievModel.PhoneNumber;
            tempCustomers.Street          = customerEditVievModel.Street;
            _context.Customerses.Update(tempCustomers);
            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateException)
            {
                return(Content("Brak dostepu do Bazy"));
            }
            return(RedirectToAction(nameof(Index)));
        }