ArticlesController.cs 572 B

12345678910111213141516171819202122232425262728293031
  1. using AppliWebANA.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. namespace AppliWebANA.Controllers {
  8. public class ArticlesController : Controller {
  9. [HttpGet]
  10. public ActionResult Index() {
  11. lock( Article.Stock ) {
  12. return View( Article.Stock.Values.ToList() );
  13. }
  14. }
  15. [HttpPost]
  16. public ActionResult Index( Article[] maj ) {
  17. if( maj != null ) {
  18. lock( Article.Stock ) {
  19. foreach( var a in maj ) {
  20. Article.Stock[a.Id] = a;
  21. }
  22. }
  23. }
  24. return Index();
  25. }
  26. }
  27. }