public IActionResult GetGeneralSettings() { var config = mapping.GetMap <GeneralSetting, GeneralSettingViewModel>(); var generalSetting = generalSettingService.GetAll().ProjectTo <GeneralSettingViewModel>(config).ToList(); return(Json(new { data = generalSetting })); }
public async Task <JsonResult> Forget(string Username) { try { var(isValid, user) = await _authLoginService.ValidateUserCredentialsAsync(Username); if (isValid) { //update user data User model = new User(); model = user; model.ChangePasswordCode = Env.Encrypt(user.Email); model.IsActive = false; _userService.Update(model); //end update user data var GetSiteRoot = $"{this.Request.Scheme}://{this.Request.Host}"; string subject = "My Password"; string body = "Click here to reset your password<br> <a href='" + GetSiteRoot + "/auth/forgot/?id=" + user.ChangePasswordCode + "'>Click Here to reset</a> "; var gs = _generalSettingService.GetAll().Where(i => i.SettingGroup == "smtp").ToArray(); Env.SendEmail(user.Email, subject, body, gs.FirstOrDefault(i => i.SettingKey == "SmtpUsername").SettingValue, gs.FirstOrDefault(i => i.SettingKey == "SmtpPassword").SettingValue, gs.FirstOrDefault(i => i.SettingKey == "SmtpPort").SettingValue, gs.FirstOrDefault(i => i.SettingKey == "SmptServer").SettingValue); return(Json(new { status = "success", message = "Successfully Please check your email." })); } else { return(Json(new { status = "warning", message = "Entered Username does not exists." })); } } catch (Exception ex) { return(Json(new { status = "error", message = ex.Message })); } }
public IActionResult Index() { DashboardViewModel homeVM = new DashboardViewModel(); homeVM.User = _userService.GetAll().Count(); homeVM.Role = _roleService.GetAll().Count(); homeVM.Menu = _menuService.GetAll().Count(); homeVM.AppSetting = _appSettingService.GetAll().Count(); homeVM.GeneralSetting = _generalSettingService.GetAll().Count(); homeVM.Notification = _notificationService.GetAll().Count(); homeVM.MenuPermission = _menuPermissionService.GetAll().Count(); homeVM.RoleUser = _roleUserService.GetAll().Sum(i => i.Id); return(View(homeVM)); }