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

namespace MvcApplication1.ViewModelBuilders
{
    public class RegisterOrganizationViewModelBuilder
    {
        public static RegisterOrganizationViewModel Build()
        {

            //retrieve OrganizationCategory from a datasource of your choosing
            //List<OrganizationCategory> OrganizationCategoryList
            //    = (List<OrganizationCategory>)OrganizationCategoryRepository.All(1, 1000);

            RegisterOrganizationViewModel viewModel = new RegisterOrganizationViewModel();
            List<OrganizationCategory> OrganizationCategoryList = new List<OrganizationCategory>();

            OrganizationCategory category1 = new OrganizationCategory
            {
                 ID = Guid.NewGuid(),
                  Name ="Company",
                   Description ="Company",
                   Isvalid=true 
            };
            OrganizationCategory category2 = new OrganizationCategory
            {
                ID = Guid.NewGuid(),
                Name = "Unit",
                Description = "Unit",
                Isvalid = true
            };

            OrganizationCategoryList.Add(category1);
            OrganizationCategoryList.Add(category2);



            viewModel.OrganizationCategory = OrganizationCategoryList.Select(s => new SelectListItem() { Text = s.Name, Value = s.ID.ToString(), Selected = (s.Name=="Company") }).AsEnumerable();
            return viewModel;
        }

    }
}
