public ActionResult Create(tbWithdrawRules tbwithdrawrules) { if (ModelState.IsValid) { db.tbWithdrawRules.Add(tbwithdrawrules); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbwithdrawrules)); }
public ActionResult Create(tbJmail tbjmail) { if (ModelState.IsValid) { db.tbJmail.Add(tbjmail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbjmail)); }
public ActionResult Create(tbBonusConfig tbbonusconfig) { if (ModelState.IsValid) { db.tbBonusConfig.Add(tbbonusconfig); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbbonusconfig)); }
public ActionResult Create(tbProduct tbproduct) { if (ModelState.IsValid) { tbproduct.Is_Delete = false; db.tbProduct.Add(tbproduct); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbproduct)); }
public ActionResult Create(tbBonusRecord tbbonusrecord) { if (ModelState.IsValid) { db.tbBonusRecord.Add(tbbonusrecord); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Member_ID = new SelectList(db.tbMemberInfo, "Member_ID", "Member_Name", tbbonusrecord.Member_ID); return(View(tbbonusrecord)); }
public ActionResult Create(tbSCenterAccount tbscenteraccount) { if (ModelState.IsValid) { db.tbSCenterAccount.Add(tbscenteraccount); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SCenter_ID = new SelectList(db.tbSCenterInfo, "SCenter_ID", "SCenter_Name", tbscenteraccount.SCenter_ID); return(View(tbscenteraccount)); }
public ActionResult Create(tbNews tbnews) { if (ModelState.IsValid) { tbnews.Release_Time = DateTime.Now; db.tbNews.Add(tbnews); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tbnews)); }
public ActionResult Create(AllyGradeView view) { if (ModelState.IsValid) { tbAllyGrade tballygrade = new tbAllyGrade();// ViewModelConvert.ConvertViewToModel(view); tballygrade.Is_Delete = false; tballygrade.Is_Hide = false; db.tbAllyGrade.Add(tballygrade); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Create(tbMemberInfo tbmemberinfo) { if (ModelState.IsValid) { db.tbMemberInfo.Add(tbmemberinfo); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AllyGrade_ID = new SelectList(db.tbAllyGrade, "AllyGrade_ID", "AllyGrade_Name", tbmemberinfo.AllyGrade_ID); ViewBag.Member_ID = new SelectList(db.tbMemberAccount, "Member_ID", "Member_ID", tbmemberinfo.Member_ID); ViewBag.SCenter_ID = new SelectList(db.tbSCenterInfo, "SCenter_ID", "SCenter_Name", tbmemberinfo.SCenter_ID); return(View(tbmemberinfo)); }
public ActionResult Create(MessageView msgview) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(msgview.Member_Name)) { ModelState.AddModelError("Member_Name", "会员名字不能为空"); return(View()); } if (string.IsNullOrEmpty(msgview.Message)) { ModelState.AddModelError("Message", "留言不能为空"); return(View()); } var query = from s in db.tbMemberInfo where s.Member_Name.Trim().ToLower() == msgview.Member_Name.Trim().ToLower() select s; List <tbMemberInfo> list = query.ToList(); if (list.Count == 0) { ModelState.AddModelError("Member_Name", "会员不存在"); return(View()); } tbMessage tbmessage = new tbMessage(); //tbmessage.Message_Time = DateTime.Now; //tbmessage.Member_ID = list[0].Member_ID; //tbmessage.Message = msgview.Message; //tbmessage.Admin_ID = int.Parse(System.Web.HttpContext.Current.Session["Admin_ID"].ToString()); //tbmessage.Message_Type = 2; db.tbMessage.Add(tbmessage); db.SaveChanges(); return(RedirectToAction("LeadIndex")); } return(View(msgview)); }
public ActionResult Create(RoleView rolevView) { if (ModelState.IsValid) { tbRole role = new tbRole(); role.Role_Name = rolevView.Role_Name; role.Is_Delete = rolevView.Is_Delete; role.Is_Hide = rolevView.Is_Hide; db.tbRole.Add(role); foreach (string s in rolevView.Menu_Name) { tbRoleMenu roleMenu = new tbRoleMenu(); roleMenu.Role_ID = role.Role_ID; roleMenu.Menu_Name = s; db.tbRoleMenu.Add(roleMenu); } db.SaveChanges(); return(RedirectToAction("Index")); } return(View(rolevView)); }
public ActionResult Create(AdminView v) { if (ModelState.IsValid) { if (v.Admin_Password == v.Confirm_Admin_Password) { tbAdmin tbadmin = new tbAdmin(); tbadmin.Admin_Name = v.Admin_Name; tbadmin.Admin_Password = FormsAuthentication.HashPasswordForStoringInConfigFile(v.Admin_Password, "SHA1"); tbadmin.Role_ID = v.Role_ID; db.tbAdmin.Add(tbadmin); db.SaveChanges(); return(RedirectToAction("Index")); } else { ModelState.AddModelError("Confirm_New_Admin_Password", "确认密码与密码不一致"); return(View()); } } ViewBag.Role_ID = new SelectList(db.tbRole, "Role_ID", "Role_Name", v.Role_ID); return(View(v)); }
public ActionResult Close(tbDataBaseState tbdatabasestate) { int id = (from s in db.tbDataBaseState select s.id).Max(); tbDataBaseState dbstate = db.tbDataBaseState.Find(id); if (dbstate.Is_Closed == false) { tbdatabasestate.Is_Closed = true; } else { tbdatabasestate.Is_Closed = true; } db.tbDataBaseState.Add(tbdatabasestate); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { string secretPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(model.Admin_Password, "SHA1"); var result = from s in db.tbAdmin where s.Admin_Name == model.Admin_Name && s.Admin_Password == secretPassword && (s.Is_Delete == false || s.Is_Delete == null) select s; if (Session["ValidateCode"].ToString() != model.ValidateCode) { ModelState.AddModelError("ValidateCode", "验证码错误"); return(View()); } if (result.ToList().Count > 0) { FormsAuthentication.SetAuthCookie(model.Admin_Name, true); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { System.Web.HttpContext.Current.Session["Admin_ID"] = result.ToList()[0].Admin_ID; System.Web.HttpContext.Current.Session["Admin_Name"] = result.ToList()[0].Admin_Name; System.Web.HttpContext.Current.Session["BackUp"] = 0; tbAdmin admin = db.tbAdmin.Find(result.ToList()[0].Admin_ID); tbRole role = db.tbRole.Find(admin.Role_ID); System.Web.HttpContext.Current.Session["Role_Name"] = role.Role_Name; System.Web.HttpContext.Current.Session["Role_ID"] = role.Role_ID; StringBuilder sb = new StringBuilder(); var query = from s in db.tbRoleMenu where s.Role_ID == role.Role_ID select s; foreach (tbRoleMenu RoleMenu in query.ToList()) { if (RoleMenu.Menu_Name != null) { sb.Append(",").Append(RoleMenu.Menu_Name); } } if (sb.ToString() == string.Empty) { System.Web.HttpContext.Current.Session["Menu_Name"] = string.Empty; } else { System.Web.HttpContext.Current.Session["Menu_Name"] = sb.ToString().Substring(1); } IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName()); string myip = IpEntry.AddressList[1].ToString(); if (IpEntry.AddressList.Length > 2) { myip = IpEntry.AddressList[2].ToString(); } //tbLog log = new tbLog(); //log.Admin_ID = result.ToList()[0].Admin_ID; //log.Login_Time = DateTime.Now; //log.IP = myip; //db.tbLog.Add(log); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", ""); } } // If we got this far, something failed, redisplay form return(View()); }