using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using HeuristicLab.Services.Optimization.Web.Models; using HeuristicLab.Services.Optimization.Billing.Interfaces; using HeuristicLab.Services.Optimization.Billing; namespace HeuristicLab.Services.Optimization.Web.Controllers { [Authorize(Roles = "Web User")] public class OrderAdminController : Controller { private IOptimizationBilling billing = new MockupOptimizationBilling(); // // GET: /OrderAdmin/ public ActionResult Index() { var orders = billing.GetOrdersByState(Billing.Model.OrderState.Created); return View(new OrderAdminModel() { Orders = orders }); } [HttpPost] public ActionResult ActivateOrder(OrderAdminModel model) { var order = (from o in billing.GetOrdersByState(Billing.Model.OrderState.Created) where o.Id == model.OrderId select o).FirstOrDefault(); order.State = Billing.Model.OrderState.Active; // TODO: Probably activate order via different method billing.SaveOrder(order); return RedirectToAction("Index"); } } }