Last change
on this file since 9556 was
9556,
checked in by fschoepp, 11 years ago
|
#1888:
- Added views for the billing component (Register users, Create orders and Activate Orders view)
- Added a mockup for the billing back-end .
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Web;
|
---|
5 | using System.Web.Mvc;
|
---|
6 | using HeuristicLab.Services.Optimization.Web.Models;
|
---|
7 | using HeuristicLab.Services.Optimization.Billing.Interfaces;
|
---|
8 | using HeuristicLab.Services.Optimization.Billing;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Services.Optimization.Web.Controllers
|
---|
11 | {
|
---|
12 | public class OrderAdminController : Controller
|
---|
13 | {
|
---|
14 | private IOptimizationBilling billing = new MockupOptimizationBilling();
|
---|
15 |
|
---|
16 | //
|
---|
17 | // GET: /OrderAdmin/
|
---|
18 |
|
---|
19 | public ActionResult Index()
|
---|
20 | {
|
---|
21 | var orders = billing.GetOrdersByState(Billing.Model.OrderState.Created);
|
---|
22 | return View(new OrderAdminModel() { Orders = orders });
|
---|
23 | }
|
---|
24 |
|
---|
25 | [HttpPost]
|
---|
26 | public ActionResult ActivateOrder(OrderAdminModel model) {
|
---|
27 | var order = (from o in billing.GetOrdersByState(Billing.Model.OrderState.Created) where o.Id == model.OrderId select o).FirstOrDefault();
|
---|
28 | order.State = Billing.Model.OrderState.Active;
|
---|
29 | // TODO: Probably activate order via different method
|
---|
30 | billing.SaveOrder(order);
|
---|
31 | return RedirectToAction("Index");
|
---|
32 | }
|
---|
33 |
|
---|
34 | }
|
---|
35 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.