コード例 #1
0
        public Guid AddCustomer(CustomerDTO client)
        {
            Customer dataModel = new Customer();

            client.CopyTo(dataModel);
            _context.Customers.Add(dataModel);
            _context.SaveChanges();
            return(dataModel.Id);
        }
コード例 #2
0
        public void UpdateCustomer(CustomerDTO client)
        {
            Customer dataModel = _context.Customers.FirstOrDefault(x => x.Id == client.Id);

            if (dataModel == null)
            {
                return;
            }
            client.CopyTo(dataModel);
            _context.SaveChanges();
            return;
        }