﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Kurswahl.DataModel;
using Kurswahl.Model;
using NLog;

namespace Kurswahl.Design
{
    public class DesignDataService : IDataService
    {
        private static readonly Logger logger = LogManager.GetCurrentClassLogger();

        public void GetKurse(Action<IList<Kurs>, Exception> callback)
        {
            var result = new List<Kurs>();

            for (var i = 0; i < 15; i++)
            {
                var kurs = GetKurs(i);
                result.Add(kurs);
            }

            callback(result, null);
        }

        public static Kurs GetKurs(int i)
        {
            return new Kurs
                {
                    Id = i,
                    IstWPU = i%3 == 0,
                    Lehrer = "Herr Dr. " + i,
                    Name = "Kurs" + i
                };
        }

        public void Save(Kurs kurs)
        {
           // MessageBox.Show("Insert " + kurs.KursName);
            logger.Trace("Insert " + kurs.Name);
            // Nix :D
        }

        public void Delete(Kurs kurs)
        {
            logger.Trace("Delete " + kurs.Id);
        }
    }
}
