本文整理汇总了C#中LoveBank.Core.MSData.LoveBankDBContext.SaveChangesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# LoveBankDBContext.SaveChangesAsync方法的具体用法?C# LoveBankDBContext.SaveChangesAsync怎么用?C# LoveBankDBContext.SaveChangesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoveBank.Core.MSData.LoveBankDBContext
的用法示例。
在下文中一共展示了LoveBankDBContext.SaveChangesAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DNameTrim
public ActionResult DNameTrim()
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
var dep = db.T_Department;
List<Department> list = (from d in dep select d).ToList();
foreach (Department item in list)
{
string sql = string.Format(@"update department d set `Name`='{0}' where d.Id='{1}'",item.Name.Trim(), item.Id);
MySqlParameter[] parm = new MySqlParameter[] { };
db.Database.ExecuteSqlCommand(sql, parm);
db.SaveChangesAsync();
}
List<Department> list2 = (from d in dep select d).ToList();
return Content("成功");
}
}
示例2: App_MachineHeartbeat
/// <summary>
/// 心跳检查一体机运行状况
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public ActionResult App_MachineHeartbeat(MachineHeartbeat entity)
{
entity.AddTime = DateTime.Now;
JsonMessage retJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
db.AddAsync<MachineHeartbeat>(entity);
db.SaveChangesAsync();
retJson.Status = true;
return Json(retJson);
}
}
示例3: LoginLog
private bool LoginLog(LoginStatistics model)
{
model.AddTime = DateTime.Now;
using (LoveBankDBContext db = new LoveBankDBContext())
{
Machine mModel = db.T_Machine.Where(x=>x.MachineCode==model.MachineCode).FirstOrDefault();
if (mModel!=null)
{
model.Lon = mModel.Lon;
model.Lat = mModel.Lat;
model.Address = mModel.Address;
}
db.Add<LoginStatistics>(model);
db.SaveChangesAsync();
}
return true;
}
示例4: App_MachineStatistics
/// <summary>
/// 统计首页各个模块点击情况
/// ModuleCode:模块自定义编码
/// ModuleId:模块Id
/// MachineCode:机器唯一编码
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public ActionResult App_MachineStatistics(MachineStatistics entity)
{
entity.AddTime = DateTime.Now;
JsonMessage retJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
var tm = db.T_Machine;
Machine mModel = tm.FirstOrDefault(x => x.MachineCode == entity.MachineCode);
if (mModel != null)
{
entity.DeptId = mModel.DeptId;
//entity.ModuleId = mModel.ID;
}
db.AddAsync<MachineStatistics>(entity);
db.SaveChangesAsync();
retJson.Status = true;
return Json(retJson);
}
}
示例5: UpdateDep
public ActionResult UpdateDep(string pid = "8")
{
List<Department> list4 = new List<Department>();
using (LoveBankDBContext db = new LoveBankDBContext())
{
var dep = db.T_Department;
List<Department> list = (from d in dep select d).ToList();
List<Department> dpname2 = list.FindAll(x => x.PId == pid);//父节点
List<Department> list3 = UpdateDepartment(dpname2);
list4.AddRange(list3);
while (list3 != null)
{
list3 = UpdateDepartment(list3);
if (list3 == null || list3.Count < 1)
{
break;
}
list4.AddRange(list3);
}
foreach (Department item in list4)
{
string sql = string.Format(@"update department d set PIds='{0}', Ids='{1}',`Names`='{2}' where d.Id='{3}'",
item.PIds, item.Ids, item.Names, item.Id);
MySqlParameter[] parm = new MySqlParameter[] { };
db.Database.ExecuteSqlCommand(sql, parm);
db.SaveChangesAsync();
}
}
var s = list4;
return Content("操作成功");
}