Пример #1
0
        public Customer CreateCustomer(
            CreateCustomerOptions options)
        {
            if (options == null)
            {
                return(null);
            }
            var customer = new Customer()
            {
                Created   = DateTimeOffset.Now,
                Firstname = options.Firstname,
                Lastname  = options.Lastname,
                Email     = options.Email,
                VatNumber = options.VatNumber,
                IsActive  = true
            };

            context.Add(customer);

            if (context.SaveChanges() > 0)
            {
                return(customer);
            }

            return(null);
        }
Пример #2
0
        public Customer CreateCustomer(
            CreateCustomerOptions options)
        {
            if (options == null)
            {
                return(null);
            }

            var customer = new Customer()
            {
                Lastname  = options.Lastname,
                Firstname = options.Firstname,
                VatNumber = options.Vatnumber
            };

            context_.Add(customer);

            if (context_.SaveChanges() > 0)
            {
                return(customer);
            }

            return(null);
        }