public ActionResult CreateCustomer(Customer incomingData)
        {
            try
                {
                    DataBase.InsertCustomer(incomingData);
                }
                catch
                {
                    return PartialView("Exception");
                }

            return View("Success", incomingData);
        }
Exemple #2
0
 partial void DeleteCustomer(Customer instance);
Exemple #3
0
 partial void UpdateCustomer(Customer instance);
Exemple #4
0
 partial void InsertCustomer(Customer instance);
 /// <summary>
 /// Create a new Customer object.
 /// </summary>
 /// <param name="customerID">Initial value of the CustomerID property.</param>
 /// <param name="nameStyle">Initial value of the NameStyle property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="passwordHash">Initial value of the PasswordHash property.</param>
 /// <param name="passwordSalt">Initial value of the PasswordSalt property.</param>
 /// <param name="rowguid">Initial value of the rowguid property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Customer CreateCustomer(global::System.Int32 customerID, global::System.Boolean nameStyle, global::System.String firstName, global::System.String lastName, global::System.String passwordHash, global::System.String passwordSalt, global::System.Guid rowguid, global::System.DateTime modifiedDate)
 {
     Customer customer = new Customer();
     customer.CustomerID = customerID;
     customer.NameStyle = nameStyle;
     customer.FirstName = firstName;
     customer.LastName = lastName;
     customer.PasswordHash = passwordHash;
     customer.PasswordSalt = passwordSalt;
     customer.rowguid = rowguid;
     customer.ModifiedDate = modifiedDate;
     return customer;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCustomers(Customer customer)
 {
     base.AddObject("Customers", customer);
 }
 public ActionResult Edit(Customer incomingData)
 {
     return View("SuccessEdit", DataBase.EditCustomer(incomingData));
 }
Exemple #8
0
 public static List<Customer> SelectAllCustomers(List<Customer> customers)
 {
     SqlDataReader reader = SQLSelectQueryCommand("Select * from [ShopDb].[dbo].[Customer]");
     customers = new List<Customer>();
     Customer customer;
     while (reader.Read())
     {
         customer = new Customer();
         customer.CustomerId = (int)reader[0];
         customer.Name = (string)reader[1];
         customer.Surname = (string)reader[2];
         customer.Phone = (string)reader[3];
         customers.Add(customer);
     }
     reader.Close();
     connection.Close();
     return customers;
 }
Exemple #9
0
 public static void InsertCustomer(Customer customer)
 {
     SQLQueryCommand(String.Format("insert into [ShopDb].[dbo].[Customer](Name,Surname,Phone) values ('{0}','{1}','{2}')",
         customer.Name, customer.Surname, customer.Phone));
 }
Exemple #10
0
 public static Customer EditCustomer(Customer customer)
 {
     SQLQueryCommand(String.Format("update [ShopDb].[dbo].[Customer] set Name = '{0}',Surname = '{1}', Phone = '{2}' where CustomerId = {3} ", customer.Name, customer.Surname, customer.Phone, customer.CustomerId));
     return customer;
 }
Exemple #11
0
 public static Customer SelectCustomerForEdit(int customerId)
 {
     SqlDataReader reader = SQLSelectQueryCommand(String.Format("Select * from [ShopDb].[dbo].[Customer] where CustomerId = {0}", customerId));
     Customer customer;
     customer = new Customer();
     while (reader.Read())
     {
         customer.CustomerId = (int)reader[0];
         customer.Name = (string)reader[1];
         customer.Surname = (string)reader[2];
         customer.Phone = (string)reader[3];
     }
     connection.Close();
     return customer;
 }
 public void CreateCustomer(Customer customerToCreate)
 {
     _entities.AddToCustomerSet(customerToCreate);
     _entities.SaveChanges();
 }
 public ActionResult Create(Customer customerToCreate)
 {
     // Add customer and address to database
     return RedirectToAction("Index");
 }
Exemple #14
0
 public ActionResult CreateCustomer()
 {
     Customer customer = new Customer();
     return View("CreateCustomer",customer);
 }
 public static void InsertCustomer(Customer cust)
 {
     var myDb = new CustomerDBEntities();
     myDb.Customers.Add(cust);
     myDb.SaveChanges();
 }