コード例 #1
0
        public void Edit(Guid clientID)
        {
            var client = _context.Clients.Where(c => c.ID == clientID).FirstOrDefault();
            Dictionary <string, string> data = ClientInput();

            client.Name        = data["name"];
            client.BussinessID = data["busID"];
            client.VAT_ID      = data["vat"];
            client.Phone       = data["phone"];
            client.Email       = data["email"];
            AdressService      adressService      = new AdressService(_context);
            ClientGroupService clientGroupService = new ClientGroupService(_context);

            Console.WriteLine("Input Address");
            client.AdressID = adressService.Create();
            Console.WriteLine("Input Delivery Address");
            client.DeliveryAdressID = adressService.Create();
            Console.WriteLine("Please select Pricelist code");
            client.PricelistCode = (PricelistCode)Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Please input Client Group Name");
            string groupName = Console.ReadLine();

            client.ClientsGroupID = clientGroupService.ReadByName(groupName);
            Console.WriteLine("Please input credit limits");
            client.CreditLimit = (double)Convert.ToInt32(Console.ReadLine());
            _context.SaveChanges();
        }
コード例 #2
0
        public void Edit(Guid client_ID)
        {
            var           branch             = _context.Branches.Where(b => b.ID == client_ID).FirstOrDefault();
            ClientService clientService      = new ClientService(_context);
            AdressService adressService      = new AdressService(_context);
            Dictionary <string, string> data = BranchInput();
            var client = _context.Clients.Where(c => c.Name == data["client"])
                         .FirstOrDefault();

            branch.Client           = client;
            branch.BranchName       = data["name"];
            branch.Phone            = data["phone"];
            branch.Email            = data["email"];
            branch.AdressID         = adressService.Create();
            branch.DeliveryAdressID = adressService.Create();
            _context.Add(branch);
            _context.SaveChanges();
        }