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

namespace Stock.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 item in maj) {
						Article.Stock[item.ID] = item;
					}
				}
			}
			return Index();
		}
    }
}