Entity Framework 之Code First自动数据迁移

using MvcShopping.Migrations;using MvcShopping.Models;using System;using System.Collections.Generic;using System.Data.Entity;using System.Linq;using System.Web;using System.Web.Http;using Syst …… 阅读全文

【MVC】MvcPager分页及边界传递数据示例

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using MvcTest.Models;using Webdiyer.WebControls.Mvc;namespace MvcTest.Controllers{ pu …… 阅读全文

【MVC】会员注册/登录,普通验证,会员名是否注册Ajax验证以及会员邮件验证实现原理

using System;using System.Collections.Generic;using System.ComponentModel;using System.ComponentModel.DataAnnotations;namespace MvcTest.Models{ public partial class Member { publ …… 阅读全文

手动打包MVC项目成Web Deploy包,发布至服务器

①确保服务器上安装了Web Deploy,可以使用微软Web Paltform Installer安装。https://www.microsoft.com/web/downloads/platform.aspx②VS中生成Web Deploy打包文件③确保系统服务中“Web部署代理服务”已经启动④查看打包文件生成目录,其中“MvcShopping.deploy. …… 阅读全文

使用Entify Framework 6.x的事务操作

public void TransactionsTest() { using (var context = new testContext()) { //使用EF事务 在vs2013中先升级Entity Framework框架至6.x //工具 - Nuget程序包管理 …… 阅读全文

MVC中View界面数据呈现示例

@using System.Text;@model List@{ ViewBag.Title = "测试程序"; }接收控制器传递的数据 @ViewBag.UserName显示Model的名称:@Html.DisplayNameFor(model => model[0])现在时间:@DateTime.Now启用状态:@ViewBag.Title多行C#代码@{ v …… 阅读全文

MVC中Controller控制器相关技术

第6章Controller相关技术Controller(控制器)在ASP.NET MVC中负责控制所有客户端与服务器端的交互,并 且负责协调Model与View之间的数椐传递,是ASP.NET MVC整体运作的核心角色,非常重6.3 Controller的运行过程在ASP.NET MVC中并非所有动作方法都必须回传ActionResult类别或其衍生类别,也可以直接使用.NET内建的基本数据 …… 阅读全文

ASP.NET MVC AJAX的调用示例

@{ ViewBag.Title = "Home Page"; //下面引用Jquery和unobtrusive-ajax}@Scripts.Render("~/bundles/jquery") @{ //设置ajaxOptions var ajaxOptions = new AjaxOptions() { OnSuccess = "S …… 阅读全文