public bool AddNavigation(Entity.m_Navigation model) { CommonRepository repository = new CommonRepository(); model.ClickCount = 0; return(repository.Add(model)); }
public string AddTheme(ViewModels.AddDocsThemeRequestViewModel requestViewModel) { if (requestViewModel.Title.Trim().Length <= 0) { return("请输入文档主题标题"); } if (requestViewModel.Contents.Trim().Length <= 0) { return("请输入文档主题内容"); } Entity.m_DocsTheme model = new Entity.m_DocsTheme(); model.AppendTime = DateTime.Now; model.Contents = requestViewModel.Contents; model.IsShow = true; model.LastTime = DateTime.Now; model.PlusCount = 0; model.ReadCount = 0; model.Tags = ""; model.Title = Framework.Core.HtmlFilter.StripHtml(requestViewModel.Title); model.UserId = Framework.Core.Transform.GetInt(HttpContext.Session.GetString("UserId"), 0); model.VersionText = ""; CommonRepository repository = new CommonRepository(); return(repository.Add(model) ? "ok" : "数据保存失败,请稍后再尝试提交."); }
public bool AddGroup(Entity.m_UserGroup model) { model.IsDefault = false; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
public bool AddMenu(Entity.m_ManagerMenu model) { model.IsPower = model.ParentId > 0 ? true : false; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
/// <summary> /// 添加标签 /// </summary> /// <param name="TagsName"></param> /// <returns></returns> public bool AddTags(string tagsName) { Entity.m_PostsTags model = new Entity.m_PostsTags(); model.TagsName = tagsName; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
public bool AddMenu(Entity.m_UserGroupMenu model) { model.AreaName = model.AreaName == null ? "" : model.AreaName; model.ControllerName = model.ControllerName == null ? "" : model.ControllerName; model.ActionName = model.ActionName == null ? "" : model.ActionName; model.IsPower = model.ControllerName == null || model.ControllerName == "" ? false : true; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
public bool AddNavigation(string navigationName, string linkUrl, int sortCount, bool isTarget, bool isShow) { Entity.m_WebSiteNavigation model = new Entity.m_WebSiteNavigation(); model.AppendTime = DateTime.Now; model.IsShow = isShow; model.IsTarget = isTarget; model.LinkUrl = linkUrl; model.NavigationName = navigationName; model.SortCount = sortCount; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
/// <summary> /// 添加频道 /// </summary> /// <param name="channelName"></param> /// <param name="remarks"></param> /// <param name="isManager"></param> /// <param name="isShow"></param> /// <param name="sortCount"></param> /// <returns></returns> public bool AddChannel(string channelName, string remarks, bool isManager, bool isShow, int sortCount) { Entity.m_PostsChannel model = new Entity.m_PostsChannel(); model.AppendTime = DateTime.Now; model.IsShow = isShow; model.IsManager = isManager; model.Remarks = remarks; model.ChannelName = channelName; model.SortCount = sortCount; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }
public bool Add(string roleName) { bool Result = false; if (!string.IsNullOrEmpty(roleName)) { Entity.m_ManagerRole model = new Entity.m_ManagerRole(); model.RoleName = roleName; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); } return(Result); }
public bool Add(int roleId, string adminName, string password) { bool Result = false; if (!string.IsNullOrEmpty(adminName) && !string.IsNullOrEmpty(password)) { Entity.m_ManagerAccount model = new Entity.m_ManagerAccount(); model.AdminName = adminName; model.Password = Framework.Core.TextHelper.MD5Encrypt(password); model.RoleId = roleId; model.IsStatus = true; CommonRepository repository = new CommonRepository(); return(repository.Add(model)); } return(Result); }
//ReleaseNotes/Add public ActionResult Add() { var data = repo.Add(new ReleaseNotesModel() { is_active = false, created_on = DateTime.Now }); if (data != null) { return(RedirectToAction("Save", "ReleaseNotes", new { @id = data.Id })); } else { ModelState.AddModelError("", "Somehting went wront. Please try again"); return(RedirectToAction("Index", "ReleaseNotes")); } }
//SmtpServers/Add public ActionResult Add() { var data = repo.Add(new MailConfigModel() { IsActive = false, CreatedOn = DateTime.Now }); if (data != null) { return(RedirectToAction("Save", "SmtpServers", new { @id = data.Id })); } else { ModelState.AddModelError("", "Somehting went wront. Please try again"); return(RedirectToAction("Index", "SmtpServers")); } }
//EmailTemplates/Add public ActionResult Add() { var data = repo.Add(new EmailTemplateMaster() { IsActive = false, CreatedOn = DateTime.Now, TemplateCode = "MAIL" + DateTime.Now.ToString("MMddyyyyHHmmss") }); if (data != null) { return(RedirectToAction("Save", "EmailTemplates", new { @id = data.Id })); } else { ModelState.AddModelError("", "Somehting went wront. Please try again"); return(RedirectToAction("Index", "EmailTemplates")); } }
//Blogs/Add public ActionResult Add() { var data = repo.Add(new BloggingDbModel() { IsActive = false, CreatedOn = DateTime.Now, //ProjectCode = "PROJECT" + DateTime.Now.ToString("MMddyyyyHHmmss") }); if (data != null) { return(RedirectToAction("Save", "Blogs", new { @id = data.Id })); } else { ModelState.AddModelError("", "Somehting went wront. Please try again"); return(RedirectToAction("Index", "Blogs")); } }
public string SendPhoneValidateCode(string phone, string ticket, string randstr) { UserRepository user = new UserRepository(); string userIP = Request.HttpContext.Connection.RemoteIpAddress.ToString(); bool tencentCaptchaResult = TencentCaptcha(ticket, randstr, userIP); if (!tencentCaptchaResult) { return("你的验证操作没有通过!"); } Regex regex = new Regex("^1[3456789]\\d{9}$"); if (!regex.IsMatch(phone)) { return("请输入正确的手机号验证码!"); } if (!user.GetSendSmsState(phone, userIP)) { return("你已经超过短信获取次数限制"); } //短信发送处理 string PhoneCode = new Random().Next(103113, 985963).ToString(); HttpContext.Session.SetString("ValidatePhoneCode", PhoneCode); HttpContext.Session.SetString("ValidatePhone", phone); Common.Aliyun.Sms sms = new Common.Aliyun.Sms(); var smsResult = sms.SendSmsCode(phone, PhoneCode).Result; //插入短信发送记录 Entity.m_Sms model = new Entity.m_Sms(); model.Contents = string.Format("短信验证码为:{0} 服务器返回结果:{1}", PhoneCode, smsResult.response); model.IsOk = smsResult.success; model.Phone = phone; model.SendIP = userIP; model.SendTime = DateTime.Now; CommonRepository repository = new CommonRepository(); repository.Add(model); return(smsResult.success ? "注册验证码发送成功,请注意查收!" : "注册验证码发送失败,请稍后再试!"); }
public bool Add(ViewModels.AddPostsViewModel model) { // Entity.m_Posts m = new Entity.m_Posts(); m.Contents = model.Contents;//Framework.Core.HtmlFilter.SanitizeHtml(model.Contents); m.ImgUrl = string.Empty; m.IsReply = true; m.IsShow = true; m.LastDate = DateTime.Now; m.PlusCount = 0; m.PostDate = DateTime.Now; m.Tags = ""; m.ReadCount = 0; m.Title = Framework.Core.HtmlFilter.StripHtml(model.Title); m.UserId = Framework.Core.Transform.GetInt(HttpContext.Session.GetString("UserId"), 0); m.AnswerCount = 0; m.ChannelId = model.ChannelId; CommonRepository repository = new CommonRepository(); return(repository.Add(m)); }
public bool AddToken(AspNetUserSecurityTokenDTO model) { var securityToken = model.Map <AspNetUserSecurityToken>(); return(_securityTokenRepository.Add(securityToken)); }
public bool AddClassify(Entity.m_NavigationClassify model) { CommonRepository repository = new CommonRepository(); return(repository.Add(model)); }