using AppliWebANA.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AppliWebANA.Controllers {
	public class ArticlesController : Controller {

		[HttpGet]
		public ActionResult Index() {
			lock( Article.Stock ) {
				return View( Article.Stock.Values.ToList() );
			}
		}

		[HttpPost]
		public ActionResult Index( Article[] maj ) {
			if( maj != null ) {
				lock( Article.Stock ) {
					foreach( var a in maj ) {
						Article.Stock[a.Id] = a;
					}
				}
			}
			return Index();
		}

	}
}