public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, ILogger log) { _UserManager = userManager; _SignInManager = signInManager; container = MvcApplication.BootstrapContainer(); log = container.Resolve <ILogger>(); }
public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager) { UserManager = userManager; SignInManager = signInManager; var container = MvcApplication.BootstrapContainer(); log = container.Resolve <ILogger>(); }
public DonationsController() { container = MvcApplication.BootstrapContainer(); log = container.Resolve <ILogger>(); donationRepository = container.Resolve <IDonationRepository>(); userRepository = container.Resolve <IUserRepository>(); requestRepository = container.Resolve <IRequestRepository>(); }
public ActionResult Chat() { var container = MvcApplication.BootstrapContainer(); IUserRepository userRepository = container.Resolve <IUserRepository>(); var user = userRepository.GetByUserName(User.Identity.Name); dynamic me = new System.Dynamic.ExpandoObject(); me.UserName = user.UserName; me.Name = user.FirstName; me.LastName = user.LastName; me.Avatar = user.ImageUrl; me.ConnectedDateTime = DateTime.Now; ViewBag.Me = me; return(View()); }
public ManageController() { var container = MvcApplication.BootstrapContainer(); log = container.Resolve <ILogger>(); }
public static HtmlString GravatarImage(this HtmlHelper htmlHelper, string userName, string action = null, string controllerName = null, object routeValues = null, GravatarOptions options = null) { if (options == null) { options = GravatarOptions.GetDefaults(); } var imgTag = new TagBuilder("img"); User user = null; if (HttpContext.Current.Session["UserSettings"] != null) { user = (new User()).ToObject(HttpContext.Current.Session["UserSettings"].ToString()); } if (user == null && HttpContext.Current.User.Identity.IsAuthenticated) { var container = MvcApplication.BootstrapContainer(); var userRepository = container.Resolve <IUserRepository>(); user = userRepository.GetByUserName(HttpContext.Current.User.Identity.Name); if (user != null) { HttpContext.Current.Session["UserSettings"] = user.ToJson(); } } if (!string.IsNullOrEmpty(options.CssClass)) { imgTag.AddCssClass(options.CssClass); } var imageUrl = user != null && !string.IsNullOrEmpty(user.ImageUrl) ? user.ImageUrl : "/img/no-photo.png"; var format = string.Format("{0}?width={1}&height={2}", imageUrl, 50, 50 ); if (imageUrl.Contains("?sz")) { format = imageUrl; } imgTag.Attributes.Add("src", format); imgTag.MergeAttribute("width", "50px"); imgTag.MergeAttribute("height", "50px"); imgTag.MergeAttribute("alt", "Manage"); // build the <a> tag if (!string.IsNullOrEmpty(action) && !string.IsNullOrEmpty(controllerName)) { var url = new UrlHelper(htmlHelper.ViewContext.RequestContext); string imgHtml = imgTag.ToString(TagRenderMode.SelfClosing); var anchorBuilder = new TagBuilder("a"); anchorBuilder.MergeAttribute("href", action.Contains("#") && controllerName.Contains("#")? "#" : url.Action(action, controllerName, routeValues)); anchorBuilder.MergeAttribute("class", "avatar-image-container"); anchorBuilder.MergeAttribute("title", "Click to Manage"); anchorBuilder.InnerHtml = imgHtml; // include the <img> tag inside string anchorHtml = anchorBuilder.ToString(TagRenderMode.Normal); return(new HtmlString(anchorHtml)); } return(new HtmlString(imgTag.ToString(TagRenderMode.SelfClosing))); }
public AccountController() { container = MvcApplication.BootstrapContainer(); log = container.Resolve <ILogger>(); }