Last change
on this file since 9558 was
9558,
checked in by fschoepp, 11 years ago
|
#1888:
- Added Usage statistic classes; added authorization attributes to web controllers.
|
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 | [Authorize(Roles = "Web User")]
|
---|
13 | public class OrderAdminController : Controller
|
---|
14 | {
|
---|
15 | private IOptimizationBilling billing = new MockupOptimizationBilling();
|
---|
16 |
|
---|
17 | //
|
---|
18 | // GET: /OrderAdmin/
|
---|
19 |
|
---|
20 | public ActionResult Index()
|
---|
21 | {
|
---|
22 | var orders = billing.GetOrdersByState(Billing.Model.OrderState.Created);
|
---|
23 | return View(new OrderAdminModel() { Orders = orders });
|
---|
24 | }
|
---|
25 |
|
---|
26 | [HttpPost]
|
---|
27 | public ActionResult ActivateOrder(OrderAdminModel model) {
|
---|
28 | var order = (from o in billing.GetOrdersByState(Billing.Model.OrderState.Created) where o.Id == model.OrderId select o).FirstOrDefault();
|
---|
29 | order.State = Billing.Model.OrderState.Active;
|
---|
30 | // TODO: Probably activate order via different method
|
---|
31 | billing.SaveOrder(order);
|
---|
32 | return RedirectToAction("Index");
|
---|
33 | }
|
---|
34 |
|
---|
35 | }
|
---|
36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.