/// <summary> /// /// </summary> /// <param name="dbContext"></param> /// <param name="mapper"></param> public UserController(haiKanChemistryContext dbContext, IMapper mapper, IOptions <MdDesEncrypt> mdDesEncrypt, IOptions <AppAuthenticationSettings> appSettings) { _appSettings = appSettings.Value; _dbContext = dbContext; _mapper = mapper; MdDesEncrypt = mdDesEncrypt.Value; }
/// <summary> /// 新闻来源数量 /// </summary> /// <param name="guid"></param> /// <returns></returns> private static int NewCount(Guid guid) { using (haiKanChemistryContext db = new haiKanChemistryContext()) { var count = 0; count = db.News.Where(x => x.NewsTypeUuid == guid).Count(); return(count); } }
/// <summary> /// 获取链接类别 /// </summary> /// <param name="type"></param> /// <returns></returns> public Guid GetGuid(string type) { using (haiKanChemistryContext hcc = new haiKanChemistryContext()) { var guid = Guid.Empty; var query = hcc.LinkType.FirstOrDefault(x => x.Class == type); if (query != null) { guid = query.LinkTypeUuid; } return(guid); } }
public static string AddLog(string Typem, string Content, haiKanChemistryContext _dbContext) { string messange = ""; var entity = new HaikanCMS.Api.Entities.SystemLog(); entity.SystemLogUuid = Guid.NewGuid(); entity.UserId = AuthContextService.CurrentUser.Guid.ToString(); entity.UserName = AuthContextService.CurrentUser.LoginName; entity.Type = Typem; entity.OperationContent = Content; entity.OperationTime = DateTime.Now; entity.AddTime = DateTime.Now; entity.AddPeople = "系统日志"; entity.IsDelete = 0; _dbContext.SystemLog.Add(entity); _dbContext.SaveChanges(); return(messange); }
private string GetroleName(string ids) { string s = ""; string[] temp = ids.TrimEnd(',').Split(','); using (haiKanChemistryContext cc = new haiKanChemistryContext()) { for (int i = 0; i < temp.Length; i++) { if (!string.IsNullOrEmpty(temp[i])) { var qu = cc.SystemRole.Where(x => x.SystemRoleUuid == Guid.Parse(temp[i])).Select(x => new { x.RoleName }).ToList(); if (!string.IsNullOrEmpty(qu[0].RoleName)) { s += qu[0].RoleName + ","; } } } return(s.TrimEnd(',')); } }
/// <summary> /// /// </summary> /// <param Link="dbContext"></param> /// <param Link="mapper"></param> /// <param Link="hostingEnvironment"></param> public ExternalLinkInfoController(haiKanChemistryContext dbContext, IMapper mapper, IWebHostEnvironment hostingEnvironment) { _dbContext = dbContext; _mapper = mapper; _hostingEnvironment = hostingEnvironment; }
/// <summary> /// /// </summary> /// <param NewsTitle="dbContext"></param> /// <param NewsTitle="mapper"></param> /// <param NewsTitle="hostingEnvironment"></param> public RestsDataController(haiKanChemistryContext dbContext, IMapper mapper, IWebHostEnvironment hostingEnvironment) { _dbContext = dbContext; _mapper = mapper; _hostingEnvironment = hostingEnvironment; }
/// <summary> /// /// </summary> /// <param name="dbContext"></param> public AccountController(haiKanChemistryContext dbContext) { _dbContext = dbContext; }
/// <summary> /// /// </summary> /// <param name="dbContext"></param> /// <param name="mapper"></param> public MenuController(haiKanChemistryContext dbContext, IMapper mapper) { _dbContext = dbContext; _mapper = mapper; }
/// <summary> /// /// </summary> /// <param name="appSettings"></param> public OauthController(IOptions <AppAuthenticationSettings> appSettings, haiKanChemistryContext dbContext, IOptions <MdDesEncrypt> mdDesEncrypt) { _appSettings = appSettings.Value; _dbContext = dbContext; MdDesEncrypt = mdDesEncrypt.Value; }
/// <summary> ///构造函数 /// </summary> /// <param name="dbContext"></param> /// <param name="iWebHostEnvironment"></param> public GlobalController(haiKanChemistryContext dbContext, IWebHostEnvironment iWebHostEnvironment) { _dbContext = dbContext; //_mapper = mapper; _hostEnv = iWebHostEnvironment; }