public ActionResult CreateOrder(Order o)
        {
            if (ModelState.IsValid)
            {
                o.BuyerID = buyerRepository.ValidID(Convert.ToInt32(Session["buyerID"])).ID;
                o.Date = DateTime.Now.Date;
                orderRepository.Add(o);

                /************** Saving log ***************/

                log.DoAll("Order: " + o.No + ", " + o.Color + ", " + o.Size
                    + ", " + o.Amount + ", " + o.Dia + ", " + o.Shade
                    + ", " + o.Date + ", " + o.BuyerID + ".");

                /*****************************************/

                orderRepository.Save();
                return View("Buyer", buyerRepository.GetBuyer(Convert.ToInt32(Session["buyerID"])));
            }
            return View("~/Views/Home/Error.aspx");
        }
 //Creting new order
 public ActionResult CreateOrder(int id)
 {
     //Session["buyerID"] = id;
     Order o = new Order();
     return View(o);
 }
 /// <summary>
 /// Create a new Order object.
 /// </summary>
 /// <param name="no">Initial value of the No property.</param>
 /// <param name="color">Initial value of the Color property.</param>
 /// <param name="size">Initial value of the Size property.</param>
 /// <param name="amount">Initial value of the Amount property.</param>
 /// <param name="dia">Initial value of the Dia property.</param>
 /// <param name="shade">Initial value of the Shade property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="buyerID">Initial value of the BuyerID property.</param>
 public static Order CreateOrder(global::System.Int32 no, global::System.String color, global::System.Double size, global::System.Double amount, global::System.Double dia, global::System.Double shade, global::System.DateTime date, global::System.Int32 buyerID)
 {
     Order order = new Order();
     order.No = no;
     order.Color = color;
     order.Size = size;
     order.Amount = amount;
     order.Dia = dia;
     order.Shade = shade;
     order.Date = date;
     order.BuyerID = buyerID;
     return order;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrders(Order order)
 {
     base.AddObject("Orders", order);
 }
 //Insert
 public void Add(Order o)
 {
     entities.Orders.AddObject(o);
 }