本文整理汇总了C#中LoveBank.Core.MSData.LoveBankDBContext.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# LoveBankDBContext.SaveChanges方法的具体用法?C# LoveBankDBContext.SaveChanges怎么用?C# LoveBankDBContext.SaveChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoveBank.Core.MSData.LoveBankDBContext
的用法示例。
在下文中一共展示了LoveBankDBContext.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdminApply
public ActionResult AdminApply(int id, int state, string msg)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
Supervise model = db.T_Supervise.Find(id);
var vol = db.T_Vol;
Vol vEntity = vol.Find(model.AddUser);
if (model.State != SuperviseRowState.已回复)
{
vEntity.LoveBankScore = vEntity.LoveBankScore + 5;
db.Update<Vol>(vEntity);
db.SaveChanges();
}
model.Msg = msg.Trim();
model.State = (SuperviseRowState)state;
db.Update<Supervise>(model);
db.SaveChanges();
#region 发送通知信息
//短信通知
//string failMsg = "【社区1+1】您于" + model.AddTime.ToString("yyyy-MM-dd HH:mm") + "投诉的:" + model.Content + ".管理员处理,处理意见是:" + msg;
SMSComm.Send(vEntity.Phone, "【社区1+1】您于" + model.AddTime.ToString("yyyy-MM-dd HH:mm") + "反映的问题我们将尽快核实处理,感谢您的参与.");
//App 推送通知待完善
#endregion
}
return Success("操作成功");
}
示例2: AppPostAddSuggestion
public ActionResult AppPostAddSuggestion(Suggestion entity)
{
JsonMessage retJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
if (entity.AddUser>0)
{
var addUserModel = (from v in db.T_Vol where v.ID == entity.AddUser select new { v.DepId, v.Phone, v.RealName }).FirstOrDefault();
entity.DepId = addUserModel.DepId;
entity.AddUserName = addUserModel.RealName;
entity.AddUserPhone = addUserModel.Phone;
}
entity.AddTime = DateTime.Now;
db.Add<Suggestion>(entity);
db.SaveChanges();
retJson.Status = true;
retJson.Info = "新增成功";
}
return Json(retJson);
}
示例3: AppPostTSAdd
public ActionResult AppPostTSAdd(Supervise entity)
{
JsonMessage retJson = new JsonMessage();
try
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
entity.AddTime = DateTime.Now;
db.Add(entity);
db.SaveChanges();
retJson.Status = true;
retJson.Info = "新增成功";
}
return Json(retJson);
}
catch (Exception ex)
{
retJson.Status = false;
retJson.Data = ex.Message + ex.TargetSite;
return Json(retJson);
}
}
示例4: AppPostHelperMoney
/// <summary>
/// 必传参数
/// AppUserId/
/// SeekHelperId/
/// Money:捐助的金额
/// BankCard:支付卡号
/// Desc:捐赠寄语
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public ActionResult AppPostHelperMoney(SeekHelperRecorde entity)
{
JsonMessage ret = new JsonMessage();
entity.AddTime = DateTime.Now;
using (LoveBankDBContext db = new LoveBankDBContext())
{
var t_a = db.T_SeekHelper;
var t_sr = db.T_SeekHelperRecorde;
var t_u = db.T_AppUser; ;
//SeekHelper sh = t_a.Find(entity.SeekHelperId);
AppUser au = t_u.Find(entity.AppUserId);
entity.Name = au.Name;
entity.Phone = au.Phone;
entity.AppUserType = au.Type;
db.Add(entity);
db.SaveChanges();
ret.Status = true;
ret.Info = "捐助成功";
return Json(ret);
}
}
示例5: Delete
public ActionResult Delete(int id)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
AdminUser user = db.T_AdminUser.Find(id);
db.Delete<AdminUser>(user);
db.SaveChanges();
return Success("操作成功");
}
}
示例6: Delete
public ActionResult Delete(int id)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
Notice notice = db.T_Notice.Find(id);
db.Delete<Notice>(notice);
db.SaveChanges();
db.Dispose();
return Success("操作成功");
}
}
示例7: Delete
public ActionResult Delete(int id)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
AppVer img = db.T_AppVer.Find(id);
db.Delete<AppVer>(img);
db.SaveChanges();
db.Dispose();
return Success("操作成功");
}
}
示例8: ChangeStateAdImg
public ActionResult ChangeStateAdImg(int id, int state)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
AppVer img = db.T_AppVer.Find(id);
img.State = state;
db.Update<AppVer>(img);
db.SaveChanges();
db.Dispose();
return Success("操作成功");
}
}
示例9: Delete
public ActionResult Delete(int id)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
var t_i = db.T_InfoManage;
InfoManage iEntity = t_i.Find(id);
iEntity.State = RowState.删除;
db.Update(iEntity);
db.SaveChanges();
return Success("删除成功");
}
}
示例10: PostAddSupervise
public ActionResult PostAddSupervise(Supervise entity)
{
JsonMessage retJson = new JsonMessage();
entity.DepId = BaseWebSiteConifg.DeptId;
using (LoveBankDBContext db = new LoveBankDBContext())
{
if (User != null)
{
entity.AddUserName = User.RealName;
entity.AddUserPhone = User.Phone;
entity.AddUser = User.ID;
}
entity.AddTime = DateTime.Now;
db.Add<Supervise>(entity);
db.SaveChanges();
retJson.Status = true;
retJson.Info = "提交成功";
}
return Json(retJson);
}
示例11: PostEdit
public ActionResult PostEdit(UnitInfoAbout parm)
{
using (LoveBankDBContext db = new LoveBankDBContext())
{
var t_wsn = db.T_UnitInfoAbout;
UnitInfoAbout model= (from w in t_wsn where w.DeptId == AdminUser.DeptId select w).FirstOrDefault();
if (model==null)
{
parm.AddUserId = AdminUser.ID;
parm.DeptId = AdminUser.DeptId;
parm.AddTime = DateTime.Now;
parm.State = RowState.有效;
db.Add(parm);
db.SaveChanges();
return Success("保存成功");
}
//UnitInfoAbout model = t_wsn.Find(parm.ID);
model.Sort = parm.Sort;
model.Address = parm.Address;
model.Title = parm.Title;
model.Content = parm.Content;
model.EMail = parm.EMail;
model.Fax = parm.Fax;
model.Type = parm.Type;
model.UnitName = parm.UnitName;
db.Update(model);
db.SaveChanges();
return Success("保存成功");
}
}
示例12: PostAddDetail
public ActionResult PostAddDetail(UnionHelpPojectDetail parm)
{
#region 初始化参数
//LoveBank_Ad model = new LoveBank_Ad();
parm.AddTime = DateTime.Now;
parm.AddUserId = AdminUser.ID;
parm.State = RowState.有效;
#endregion
JsonMessage rJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
db.Add(parm);
db.SaveChanges();
rJson.Status = true;
rJson.Info = "新增成功";
rJson.Data = parm;
return Json(rJson);
}
}
示例13: PostAdd
public ActionResult PostAdd(UnionHelpPoject parm)
{
#region 初始化参数
//LoveBank_Ad model = new LoveBank_Ad();
parm.AddTime = DateTime.Now;
parm.AddUserId = AdminUser.ID;
parm.State = RowState.有效;
parm.GUID = Guid.NewGuid().ToString();
#endregion
using (LoveBankDBContext db = new LoveBankDBContext())
{
db.Add(parm);
db.SaveChanges();
return Success("添加成功");
}
}
示例14: App_MachineReg
/// <summary>
/// 机器注册接口
/// </summary>
/// <param name="model"></param>
/// <param name="phone"></param>
/// <returns></returns>
public ActionResult App_MachineReg(Machine model, string phone)
{
model.AddTime = DateTime.Now;
model.State = RowState.有效;
model.AddUserId = -1;
JsonMessage retJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
var t_a = db.T_AdminUser;
var t_m = db.T_Machine;
if (t_m.Count(x => x.MachineCode == model.MachineCode) > 0)
{
retJson.Status = false;
retJson.Info = "该设备已经注册";
return Json(retJson);
}
if (t_a.Count(x => x.Phone == phone) == 0)
{
retJson.Status = false;
retJson.Info = "手机号不存在";
return Json(retJson);
}
db.Add<Machine>(model);
db.SaveChanges();
if (db.T_MachineModuleShowManage.Count(x => x.DeptId == model.DeptId) == 0)
{
///初始化模块 积分商城:JFSC
MachineModuleShowManage initMachineModule1 = new MachineModuleShowManage()
{
Name = "积分商城",
ModuleKey = "JFSC",
DeptId = model.DeptId,
AddTime = DateTime.Now,
AddUserId = -1,
Guid = "e96fdf19-465c-4190-b47b-27a9af8ecfd4",
Icon = "http://www.24hmart.cn:8082/iplustv/shouye/jfsc.png"
};
///初始化模块 社区公益:SQGY
MachineModuleShowManage initMachineModule2 = new MachineModuleShowManage()
{
Name = "社区公益",
ModuleKey = "SQGY",
DeptId = model.DeptId,
AddTime = DateTime.Now,
AddUserId = -1,
Guid = "bb2ee2e2-3487-4853-846c-75f71558e389",
Icon = "http://www.24hmart.cn:8082/iplustv/shouye/sqgy.png"
};
///初始化模块 网格员:WGY
MachineModuleShowManage initMachineModule3 = new MachineModuleShowManage()
{
Name = "网格员",
ModuleKey = "WGY",
DeptId = model.DeptId,
AddTime = DateTime.Now,
AddUserId = -1,
Guid = "e5eafdf6-076f-4ac7-9fd0-38d3c935dd0c",
Icon = "http://www.24hmart.cn:8082/iplustv/shouye/wgy.png"
};
#region 初始化数据
///初始化模块 办事指南:BSZN
MachineModuleShowManage initMachineModule4 = new MachineModuleShowManage()
{
Name = "办事指南",
ModuleKey = "BSZN",
DeptId = model.DeptId,
AddTime = DateTime.Now,
AddUserId = -1,
Guid = "d2ffce6d-9a2a-4f12-869d-5962b18b571e",
Icon = "http://www.24hmart.cn:8082/iplustv/shouye/bszn.png"
};
///初始化模块 社区动态:SQDT
MachineModuleShowManage initMachineModule5 = new MachineModuleShowManage()
{
Name = "社区动态",
ModuleKey = "SQDT",
DeptId = model.DeptId,
AddTime = DateTime.Now,
AddUserId = -1,
Guid = "de359c69-c7e1-410d-8291-f8717198bc82",
Icon = "http://www.24hmart.cn:8082/iplustv/shouye/sqdt.png"
};
///初始化模块 生活圈:SHQ
//.........这里部分代码省略.........
示例15: AppUserReg
public ActionResult AppUserReg(AppUser user, string code)
{
if (user == null || string.IsNullOrEmpty(code) || user.Type == null || string.IsNullOrEmpty(user.PassWord) && string.IsNullOrEmpty(user.Phone))
{
Json("注册账号、密码、验证码和用户类型是必填项");
}
user.PassWord = user.PassWord.Hash();//hash
user.AddTime = DateTime.Now;
user.LastLoginTime = DateTime.Now;
JsonMessage returnJson = new JsonMessage();
using (LoveBankDBContext db = new LoveBankDBContext())
{
try
{
if (db.T_AppUser.Count(x => x.Phone == user.Phone) > 0)
{
returnJson.Info = "该手机号已经存在,不能注册";
returnJson.Status = false;
return Json(returnJson);
}
DateTime codeOutTime = DateTime.Now.AddMinutes(-10);
int existCount = db.T_SMS.Count(x => x.Phone == user.Phone.Trim() && x.VCode == code.Trim() && x.Class == SmsClass.注册验证码 && x.AddTime > codeOutTime);
if (existCount == 0)
{
returnJson.Info = "注册验证码失效,请重新获取";
returnJson.Status = false;
return Json(returnJson);
}
db.Add(user);
db.SaveChanges();
returnJson.Status = true;
returnJson.Info = "注册成功";
returnJson.Data = user;
return Json(returnJson);
}
catch (Exception ex)
{
returnJson.Info = ex.Message;
returnJson.Status = false;
return Json(returnJson);
}
}
}