Ejemplo n.º 1
0
        public ActionResult OrderAdd(int clientPersonalID, string brand, string model, string plateNumber, string description)
        {
            Client client = dbWrapper.GetClientByPersonalID(clientPersonalID);

            if (client != null)
            {
                Order newOrder = new Order();
                newOrder.date_created = Models.Utils.Util.GetCurrentTime();
                newOrder.state        = "PEND";
                newOrder.client_id    = client.id;
                newOrder.employee_id  = Models.Utils.Util.GetRandomEmployee();
                newOrder.brand        = brand;
                newOrder.model        = model;
                newOrder.plate_number = plateNumber;
                newOrder.description  = description;
                newOrder.workshop_id  = 1;

                dbWrapper.AddOrder(newOrder);
                //TODO: crear CSV con historial de ordenes, y tal vez mandar datos de orden final por mail (ahre)
            }

            return(RedirectToAction("Index", "Home"));
        }