Free cookie consent management tool by TermsFeed Policy Generator

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

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