Beispiel #1
0
        public ActionResult Create([Bind(Include = "PaymentMethodID,Name,Description")] PaymentMethod paymentMethod)
        {
            if (ModelState.IsValid)
            {
                db.PaymentMethods.Add(paymentMethod);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(paymentMethod));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "ReplacementPartID,Name,Price")] ReplacementPart replacementPart)
        {
            if (ModelState.IsValid)
            {
                db.ReplacementParts.Add(replacementPart);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(replacementPart));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "PositionID,Name,Salary")] Position position)
        {
            if (ModelState.IsValid)
            {
                db.Positions.Add(position);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(position));
        }
        public ActionResult Create([Bind(Include = "RepairID,Name,Description,Price")] Repair repair)
        {
            if (ModelState.IsValid)
            {
                db.Repairs.Add(repair);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(repair));
        }
        public ActionResult Create([Bind(Include = "CustomerID,Name,Address,Phone")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "EmployeeID,PositionID,Name,AppointmentDate,Address,Phone")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PositionID = new SelectList(db.Positions, "PositionID", "Name", employee.PositionID);
            return(View(employee));
        }
Beispiel #7
0
        public ActionResult Create([Bind(Include = "ServiceID,RepairID,EmployeeID")] Service service)
        {
            if (ModelState.IsValid)
            {
                db.Services.Add(service);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeID", "Name", service.EmployeeID);
            ViewBag.RepairID   = new SelectList(db.Repairs, "RepairID", "Name", service.RepairID);
            return(View(service));
        }
Beispiel #8
0
        public ActionResult Create([Bind(Include = "InvoiceID,CustomerID,PaymentMethodsID,Date")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                db.Invoices.Add(invoice);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerID       = new SelectList(db.Customers, "CustomerID", "Name", invoice.CustomerID);
            ViewBag.PaymentMethodsID = new SelectList(db.PaymentMethods, "PaymentMethodID", "Name", invoice.PaymentMethodsID);
            return(View(invoice));
        }
 public ActionResult Register(UserAccount account)
 {
     if (ModelState.IsValid)
     {
         using (NikkiAutoserviceContext db = new NikkiAutoserviceContext())
         {
             db.userAccount.Add(account);
             db.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.Message = account.FirstName + " " + account.LastName + " successfully registered";
     }
     return(View());
 }