public static MoadonCustomer ConvertMoadonCustomerToDAL(MoadonCustomerDTO customer)
 {
     return(new MoadonCustomer
     {
         id_customer = customer.id_customer,
         f_name = customer.f_name,
         l_name = customer.l_name,
         born_date = customer.born_date,
         phone = customer.phone,
         email = customer.email,
         bonus_points = customer.bonus_points,
         city = customer.city,
         street = customer.street,
         house_number = customer.house_number,
         password = customer.password
     });
 }
示例#2
0
        public static bool AddMoadonCustomer(MoadonCustomerDTO customer)
        {
            using (DB_shoesEntities5 db = new DB_shoesEntities5())
            {
                try
                {
                    MoadonCustomer m = converters.MoadonCustomerConverter.ConvertMoadonCustomerToDAL(customer);
                    // db.MoadonCustomers.Add(m);
                    // db.SaveChanges();



                    var          fromAddress  = new MailAddress("*****@*****.**", "Shoes-Time");
                    var          toAddress    = new MailAddress(customer.email, "To Name");
                    const string fromPassword = "******";
                    const string subject      = "Welcome to Shoes Time";
                    string       body         = $" Hi { customer.f_name} { customer.l_name} You have successfully joined our club card. \n " +
                                                $"We hope meet you again soon \n Thanks ";
                    var smtp = new SmtpClient
                    {
                        Host                  = "smtp.gmail.com",
                        Port                  = 587,
                        EnableSsl             = true,
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                    };
                    using (var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = subject,
                        Body = body
                    })

                        smtp.Send(message);



                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }
示例#3
0
 public bool AddMoadonCustomer([FromBody] MoadonCustomerDTO cust)
 {
     return(BL.MoadonCustomerBL.AddMoadonCustomer(cust));
 }