本文整理汇总了C#中City.Update方法的典型用法代码示例。如果您正苦于以下问题:C# City.Update方法的具体用法?C# City.Update怎么用?C# City.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类City
的用法示例。
在下文中一共展示了City.Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveRegion
private static SimpleJson SaveRegion()
{
string type = WebUtil.Param("type");
if (type != "p" && type != "c" && type != "d")
return new SimpleJson()
.HandleError(string.Format("Invalidate type {0} in action SaveRegion", type));
string opt = WebUtil.Param("opt");
if (opt != "create" && opt != "update")
return new SimpleJson()
.HandleError("Invalidate operation in action SaveRegion");
using (ISession session = new Session())
{
if (type == "p")
{
#region province
Province pro = new Province();
pro.Code = WebUtil.Param("code");
pro.Name = WebUtil.Param("name");
pro.Alias = WebUtil.Param("alias");
if (opt == "create")
pro.Create(session);
else
{
pro.ProvinceId = WebUtil.ParamInt("id", -1);
pro.Update(session, "Code", "Name", "Alias");
}
return pro.GetJSON();
#endregion
}
else if (type == "c")
{
#region city
City city = new City();
city.CityCode = WebUtil.Param("code");
city.Name = WebUtil.Param("name");
city.ProvinceId = WebUtil.ParamInt("parent", -1);
if (opt == "create")
{
city.Create(session);
}
else
{
city.CityId = WebUtil.ParamInt("id", -1);
city.Update(session, "CityCode", "Name");
}
return city.GetJSON();
#endregion
}
else if (type == "d")
{
#region district
District district = new District();
district.Name = WebUtil.Param("name");
district.ZipCode = WebUtil.Param("zip");
district.Door2Door = WebUtil.Param("ship") == "1" ? true : false;
district.CityId = WebUtil.ParamInt("parent", -1);
if (opt == "create")
{
district.Create(session);
}
else
{
district.DistrictId = WebUtil.ParamInt("id", -1);
district.Update(session, "Name", "ZipCode", "Door2Door");
}
return district.GetJSON();
#endregion
}
}
return null;
}