using IWareDataAccess.EF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IWareDataAccess.PDA.Version
{
public static class VersionSqlFunc
{
///
/// 搜索表
///
///
///
///
public static PDA_VERSION SearchOne(string url, string version)
{
using (Model edm = new Model())
{
PDA_VERSION pda = edm.PDA_VERSION.OrderByDescending(x => x.UpdateTime).FirstOrDefault(x => x.Url.Contains(url) && x.Version.Contains(version));
return pda;
}
}
///
/// 添加
///
///
///
///
public static bool AddOne(string url, string version)
{
using (Model edm = new Model())
{
PDA_VERSION pda = new PDA_VERSION();
pda.Version = version;
pda.Url = url;
pda.UpdateTime = DateTime.Now;
edm.PDA_VERSION.Add(pda);
if (edm.SaveChanges() > 0)
{
return true;
}
else
{
return false;
}
}
}
}
}