using CD67.FicheCollege.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;

namespace CD67.FicheCollege.Factory
{
    public partial class RestaurationParametreFactory : Internal.BaseFactory<Entity.RestaurationParametre>
    {
        public override IQueryable<Entity.RestaurationParametre> getAll()
        {
            return base.getAll();
        }

        public override void add(ref Entity.RestaurationParametre entity)
        {
            base.add(ref entity);
        }

        public override void update(ref Entity.RestaurationParametre entity)
        {
            base.update(ref entity);
        }

        public void addTypeRepas(ref Entity.RestaurationTypeRepa typeRepas, RestaurationParametre param)
        {
            param.RestaurationTypeRepas.Add(typeRepas);
            base.update(ref param);
        }

        public void removeTypeRepas(ref Entity.RestaurationTypeRepa typeRepas, RestaurationParametre param)
        {
            param.RestaurationTypeRepas.Remove(typeRepas);
            base.update(ref param);
        }

        public override void delete(ref Entity.RestaurationParametre entity)
        {
            base.delete(ref entity);
            //On supprime les types de repas liés
            entity.RestaurationTypeRepas.Clear();
            this.update(ref entity);
        }
    }
}