get.cs
[Authentication]
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Edit(Guid id)
{
#region 读取数据
if (!名称Helper.GetInfo(id, out tab_名称 obj, out _error))
{
Response.Redirect(_errorUrl("读取数据出错"));
}
#endregion
#region 权限检查 1.权限点
if (!BaseFunction.JudgeDoPoint((int) EnumInfo.DoPoints.名称_Edit))
{
Response.Redirect(_noAuthorityUrl);
return View();
}
#endregion 权限检查
#region 权限检查 2.权限点&范围
if (!BaseFunction.JudgeDoPoint((Guid)名称.SchoolId,(int) EnumInfo.DoPoints.名称_Edit))
{
Response.Redirect(_noAuthorityUrl);
return View();
}
#endregion 权限检查
ViewBag.Object = obj;
return View();
}
post.cs
[Authentication]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Guid id, FormCollection collection)
{
#region 读取数据
if(!名称Helper.GetInfo(id,out tab_名称 obj,out _error))
{
return Result.ContentResultErrorJson("获取数据出错");
}
#endregion
#region 权限检查 1.权限点
if (!BaseFunction.JudgeDoPoint((int) EnumInfo.DoPoints.名称_Edit))
{
return Result.ContentResultNoAuthorityJson();
}
#endregion
#region 权限检查 1.权限点&范围
if (!BaseFunction.JudgeDoPoint((Guid)obj.范围, (int) EnumInfo.DoPoints.名称_Edit))
{
return Result.ContentResultNoAuthorityJson();
}
#endregion
obj.ModifierId = CurrentUser.UserId;
obj.ModifyTime = DateTime.Now;
obj.字段 = GetValue.StringValue(collection["字段"], out isEmpty);
obj.字段 = GetValue.GuidNullValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.GuidValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.IntNullValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.IntValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.DecimalNullValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.DecimalValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.DateTimeNullValue(collection["字段"], out isEmpty, out isError);
obj.字段 = GetValue.DateTimeValue(collection["字段"], out isEmpty, out isError);
#region 值有效性检查
#endregion 值有效性检查
if(!ObjectHelper.SaveToDb(object,out _error))
{
return Result.ContentResultErrorJson("保存出错");
}
#region 日志
ActionLogHelper.ActionLog(CurrentUser, RouteData, EnumInfo.OperateType.更新.ToString(), obj.主键, obj.范围, EnumInfo.OperateContent["名称_Edit"]);
#endregion
return Result.ContentResultOperateSuccessJson();
}