using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SyncfusionMvcApplication40.Models
{
    public static class EmployeeRepository
    {
        public static List<Employee> GetEmployees()
        {
            List<Employee> employees = (List<Employee>)HttpContext.Current.Session["Employees"];

            if (employees == null)
            {
                employees = new List<Employee>();
                employees.Add(new Employee()
                {
                    ID = 0,
                    Name = "John",
                    Address = "324, 4th Avenue, Tacoma, USA",
                    DateOfBirth = DateTime.Parse("09/25/1965"),
                    MobileNumber = 9234586433
                });
                employees.Add(new Employee()
                {
                    ID = 11,
                    Name = "James",
                    Address = "164, 2nd Avenue, NY",
                    DateOfBirth = DateTime.Parse("02/12/1954"),
                    MobileNumber = 9234586433
                });

                HttpContext.Current.Session["Employees"] = employees;
            }

            return employees;
        }

        public static void AddRange(List<Employee> data)
        {
            List<Employee> employees = (List<Employee>)HttpContext.Current.Session["Employees"];

            if (employees != null)
            {
                employees.AddRange(data);
            }
        }
    }
}