using System.Collections.Generic;
using System.Data.Entity;
using System.Security;
using iiie.Logs.DBO;
using iiie.WebApiUtils.BusinessManager;
using WebAPiUtils_test.DBO;

namespace WebAPiUtils_test.DataAccess
{
    public class ValuesManager : SqlServerManager<T_SqlManager, ValuesDbo, SqlServerManagerEntities, ValuesManager>
    {
        public override DbSet<T_SqlManager> GetTable(SqlServerManagerEntities db)
        {
            return db.T_SqlManager;
        }

        public override ValuesDbo DbToDbo(T_SqlManager o)
        {
            return new ValuesDbo
            {
                Id = o.id,
                MyInt = o.my_int,
                MyString = o.my_string
            };
        }

        public override T_SqlManager DboToDb(ValuesDbo o)
        {
            return new T_SqlManager
            {
                id = o.Id,
                my_int = o.MyInt,
                my_string = o.MyString
            };
        }

        public static OpResult<IEnumerable<ValuesDbo>> Contains(string text)
        {
            return GetMultipleDbo(x => x.my_string.Contains(text));
        }
    }
}