﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RS.Projects.DAL
{
    public class WorkItemsRepository : BaseRepository
    {
        public WorkItemsRepository(string connectionString) : base(connectionString) { }

        public List<DM.WorkItem> GetWorkItems(Guid changeRequestId)
        {
            return DataContext.WorkItem.Select(el => new DM.WorkItem
            {
                Id = el.Id,
                ClientChangeRequestId = el.ClientChangeRequestId,
                Name = el.Name
            }).Where(el => el.ClientChangeRequestId == changeRequestId).OrderBy(el => el.Name).ToList();
        }
    }
}