Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OrderAdminController.cs @ 9576

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 
1using System.Linq;
2using System.Web.Mvc;
3using HeuristicLab.Services.Optimization.Billing.Business;
4using HeuristicLab.Services.Optimization.Billing.Interfaces;
5using HeuristicLab.Services.Optimization.Web.Models;
6
7namespace 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.