public GeneralController() { var _entities = new ScreenTakerEntities(); try { ViewBag.PeopleForMaster = _entities.People.Select(s => s).ToList(); } catch (Exception) { } }
protected string GetImageLink(string code) { try { var _entities = new ScreenTakerEntities(); var image = _entities.Images.Where(w => w.SharedCode == code).FirstOrDefault(); if (image != null) { return(GetBaseUrl() + "img/" + (image.ServerFolder == null ? "" : image.ServerFolder.SharedCode) + "/" + code + ".png"); } } catch { } return(GetBaseUrl() + "img/" + code + ".png"); }
public async Task <ActionResult> ConfirmEmail(int userId, string code, string lang = "en") { ViewBag.Localize = getLocale(); if (userId == default(int) || code == null) { return(View("Error")); } var result = await UserManager.ConfirmEmailAsync(userId, code); if (result.Succeeded) { using (var entities = new ScreenTakerEntities()) { var defaultFolder = new Folder() { IsPublic = true, OwnerId = userId, SharedCode = _stringGenerator.Next(), Name = "Public", CreationDate = DateTime.Now }; entities.Folders.Add(defaultFolder); var user = entities.People.Find(userId); if (user != null) { var userShares = entities.UserShares.Where(w => w.Email == user.Email); foreach (var u in userShares) { u.PersonId = user.Id; } } entities.SaveChanges(); } return(View("ConfirmEmail")); } AddErrors(result); ViewBag.Email = UserManager.FindById(userId).Email; EMAIL = ViewBag.Email; return(View()); }