You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CaiQie/DB/Service/UserService.cs

43 lines
871 B
C#

1 month ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chloe;
using DB.Entity;
namespace DB.Service
{
public class UserService
{
public UserService()
{
}
public UserInfo GetOne(string name, string pwd)
{
using (var dbContext = DbFactory.GetContext)
{
return dbContext.Query<UserInfo>()
.Where(x => x.UserName == name)
.Where(x => x.Pwd == pwd)
.FirstOrDefault();
}
}
public List<string> GetAllName()
{
using (var dbContext = DbFactory.GetContext)
{
return dbContext.Query<UserInfo>()
.Select(x => x.UserName).ToList();
}
}
}
}