当前位置: 首页>>代码示例>>C#>>正文


C# LoveBankDBContext.SaveChangesAsync方法代码示例

本文整理汇总了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("成功");
            }
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:20,代码来源:TestController.cs

示例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);
            }
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:19,代码来源:AppCommController.cs

示例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;
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:19,代码来源:AppCommController.cs

示例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);
            }
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:30,代码来源:AppCommController.cs

示例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("操作成功");
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:39,代码来源:TestController.cs


注:本文中的LoveBank.Core.MSData.LoveBankDBContext.SaveChangesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。