using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestMvcApp.EF;
using TestMvcApp.ViewModels;

namespace TestMvcApp.Controllers
{
    public class UserFacilityAdminController : Controller
    {

        public ActionResult Index()
        {
            return View();
        }

        #region Proposal Types

        public ActionResult ProposalTypes()
        {
            var context = new TestEntities();

            var model = (from a in context.Proposal_Types
                         where a.User_Facility_ID == "NSLS"
                         select new ProposalTypeViewModel()
                         {
                             ID = a.ID,
                             User_Facility_ID = a.User_Facility_ID,
                             Code = a.Code,
                             Description = a.Description,
                             Active = a.Active,
                             UserFacilities = (from f in context.User_Facilities
                                               select new SelectListItem
                                               {
                                                   Text = f.ID,
                                                   Value = f.ID
                                               })
                         });
            return View(model);
        }

        #endregion

    }
}
