Last change
on this file since 9576 was
9576,
checked in by spimming, 11 years ago
|
#1888:
- Added billing test client
- Use entity framework for DAL
- Modified service interface and model classes
|
File size:
1.1 KB
|
Line | |
---|
1 | using System.Linq;
|
---|
2 | using System.Web.Mvc;
|
---|
3 | using HeuristicLab.Services.Optimization.Billing.Business;
|
---|
4 | using HeuristicLab.Services.Optimization.Billing.Interfaces;
|
---|
5 | using HeuristicLab.Services.Optimization.Web.Models;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Services.Optimization.Web.Controllers {
|
---|
8 | [Authorize(Roles = "Web User")]
|
---|
9 | public class OrderAdminController : Controller {
|
---|
10 | private IOptimizationBilling billing = BillingServiceProvider.Instance;
|
---|
11 |
|
---|
12 | //
|
---|
13 | // GET: /OrderAdmin/
|
---|
14 |
|
---|
15 | public ActionResult Index() {
|
---|
16 | var orders = billing.GetOrdersByState(Billing.Model.OrderState.Created);
|
---|
17 | return View(new OrderAdminModel() { Orders = orders });
|
---|
18 | }
|
---|
19 |
|
---|
20 | [HttpPost]
|
---|
21 | public ActionResult ActivateOrder(OrderAdminModel model) {
|
---|
22 | var order = (from o in billing.GetOrdersByState(Billing.Model.OrderState.Created) where o.OrderId == model.OrderId select o).FirstOrDefault();
|
---|
23 | order.State = Billing.Model.OrderState.Active;
|
---|
24 | // TODO: Probably activate order via different method
|
---|
25 | billing.SaveOrder(order);
|
---|
26 | return RedirectToAction("Index");
|
---|
27 | }
|
---|
28 |
|
---|
29 | }
|
---|
30 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.