下载地址:百度网盘 请输入提取码
model :
/// <summary>
/// Model实体层
/// </summary>
namespace Smart.Model
{
/// <summary>
/// 数据实体层 city
/// </summary>
[Serializable]
public partial class city
{
#region 成员变量和公共属性
/// <summary>
///
/// </summary>
public int Id
{set; get;}
/// <summary>
///
/// </summary>
public string Code
{set; get;}
/// <summary>
///
/// </summary>
public string Name
{set; get;}
/// <summary>
///
/// </summary>
public string ProvinceId
{set; get;}
/// <summary>
/// 热搜索城市
/// </summary>
public string Hot
{set; get;}
/// <summary>
/// 是否显示
/// </summary>
public string Flg
{set; get;}
#endregion 成员变量和公共属性
}
}
EF操作数据:
#region 自动生成增删改查成员方法
/// <summary>
/// 增加一条实体数据
/// </summary>
public int Addcity()
{
EFDBHelper<city> dbhelper = new EFDBHelper<city>();
city Modelcity = new city();
Modelcity.id=@id;
Modelcity.code=@code;
Modelcity.name=@name;
Modelcity.provinceId=@provinceId;
Modelcity.hot=@hot;
Modelcity.flg=@flg;
return dbhelper.Add(Modelcity);
}
/// <summary>
/// 修改一条实体数据
/// </summary>
public int Updatecity()
{
EFDBHelper<city> dbhelper = new EFDBHelper<city>();
city Modelcity = new city();
Modelcity.id=@id;
Modelcity.code=@code;
Modelcity.name=@name;
Modelcity.provinceId=@provinceId;
Modelcity.hot=@hot;
Modelcity.flg=@flg;
return dbhelper.Update(Modelcity);
}
/// <summary>
/// 删除一条实体数据
/// </summary>
public int Deletecity()
{
EFDBHelper<city> dbhelper = new EFDBHelper<city>();
city Modelcity = new city();
Modelcity.id=@id;
Modelcity.code=@code;
Modelcity.name=@name;
Modelcity.provinceId=@provinceId;
Modelcity.hot=@hot;
Modelcity.flg=@flg;
return dbhelper.Delete(Modelcity);
}
/// <summary>
///单个实体查询
/// </summary>
public List<city>Querycity()
{
EFDBHelper<city> dbhelper = new EFDBHelper<city>();
var entityes = dbhelper.FindList(p => p.id == @id);
return entityes.ToList();
}
#endregion 自动生成增删改查成员方法
UI表示层:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>city MUI</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
</head>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">标题栏</h1>
</header>
<div class="mui-content">
<div class="mui-input-group" id="userform">
<div class="mui-input-row">
<label></label>
<input type = "text" class="mui-input-clear" id="id" name="id" placeholder="">
</div>
<div class="mui-input-row">
<label></label>
<input type = "text" class="mui-input-clear" id="code" name="code" placeholder="">
</div>
<div class="mui-input-row">
<label></label>
<input type = "text" class="mui-input-clear" id="name" name="name" placeholder="">
</div>
<div class="mui-input-row">
<label></label>
<input type = "text" class="mui-input-clear" id="provinceId" name="provinceId" placeholder="">
</div>
<div class="mui-input-row">
<label>热搜索城市</label>
<input type = "text" class="mui-input-clear" id="hot" name="hot" placeholder="热搜索城市">
</div>
<div class="mui-input-row">
<label>是否显示</label>
<input type = "text" class="mui-input-clear" id="flg" name="flg" placeholder="是否显示">
</div>
<div class="mui-button-row">
<button type ="button" class="mui-btn mui-btn-primary">确 认</button>
<button type ="button" class="mui-btn mui-btn-danger">取 消</button>
</div>
</div>
</div>
<script src ="js/mui.min.js"></script>
</body>
</html>
SQL数据脚本:
--插入
insert into city values ('@id','@code','@name','@provinceId','@hot','@flg');
--修改
update city set id='@id',code='@code',name='@name',provinceId='@provinceId',hot='@hot',flg='@flg' where + strWhere ;
--删除
delete FROM city where + strWhere ;
--查询
select id, code, name, provinceId, hot, flg FROM city where + strWhere ;
--索引
ALTER TABLE city ADD INDEX indexcity (id)
下载地址:百度网盘 请输入提取码 文章来源:https://www.toymoban.com/news/detail-662786.html
文章来源地址https://www.toymoban.com/news/detail-662786.html
到了这里,关于smartsofthelp 5.0 最干净,最简单,最方便,最全面的开发辅助优化工具,最值得推荐的程序员开发工具的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!