using ConstructorApp.DataAccessLayer.Abstract;
using ConstructorApp.DataAccessLayer.Concrete;
using ConstructorApp.DataAccessLayer.Repositories;
using ConstructorApp.EntityLayer.Entities;

namespace ConstructorApp.DataAccessLayer.EntityFramework
{
    public class EfServiceDal : GenericRepository<Service>, IServiceDal
    {
        private readonly ConstructorContext context;
        public EfServiceDal(ConstructorContext context) : base(context)
        {
            this.context = context;
        }

        public void ServiceStatusActive(int id)
        {
            var values = context.Services.Find(id);
            values.IsActive = true;
            context.SaveChanges();
        }

        public void ServiceStatusPassive(int id)
        {
            var values = context.Services.Find(id);
            values.IsActive = false;
            context.SaveChanges();
        }
    }
}
