Beispiel #1
0
        public ActionResult CreateRedirect(Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customer.AddObject(customer);
                db.SaveChanges();

                return RedirectToAction("Create", "Budget");
            }

            return View(customer);
        }
Beispiel #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Customer EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCustomer(Customer customer)
 {
     base.AddObject("Customer", customer);
 }
Beispiel #3
0
 public ActionResult Edit(Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Customer.Attach(customer);
         db.ObjectStateManager.ChangeObjectState(customer, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(customer);
 }
Beispiel #4
0
 /// <summary>
 /// Create a new Customer object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="personalId">Initial value of the PersonalId property.</param>
 /// <param name="phone">Initial value of the Phone property.</param>
 /// <param name="address">Initial value of the Address property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 public static Customer CreateCustomer(global::System.Int32 id, global::System.String name, global::System.String lastName, global::System.String personalId, global::System.String phone, global::System.String address, global::System.String email)
 {
     Customer customer = new Customer();
     customer.Id = id;
     customer.Name = name;
     customer.LastName = lastName;
     customer.PersonalId = personalId;
     customer.Phone = phone;
     customer.Address = address;
     customer.Email = email;
     return customer;
 }