Exemplo n.º 1
0
        public virtual CustomerShortModel PrepareCustomerShortModel(int Id)
        {
            var customer = _customerService.Find(Id, p => p.Posts);

            if (customer == null)
            {
                throw new ArgumentNullException($"Customer", $"Customer cannot be null");
            }

            var customerShortModel = new CustomerShortModel();

            customerShortModel.Email = customer.Email;
            customerShortModel.Name  = customer.Name;

            return(customerShortModel);
        }
        public virtual CustomerShortModel PrepareCustomerShortModel(int Id)
        {
            var customer = _customerService.Find(Id, p => p.Posts);

            if (customer == null)
            {
                customer                    = new Core.Domain.Customers.Customer();
                customer.Name               = "Cengiz";
                customer.Email              = "*****@*****.**";
                customer.Password           = "******";
                customer.PasswordSalt       = "001453";
                customer.PasswordFormatType = 1;
                _customerService.Insert(customer);
                // throw new ArgumentNullException($"Customer",$"Customer cannot be null");
            }

            var customerShortModel = new CustomerShortModel();

            customerShortModel.Email = customer.Email;
            customerShortModel.Name  = customer.Name;

            return(customerShortModel);
        }