public ActionResult AllAccountsForLead(int leadId) { Web.ViewModel.AccountInformationViewModel AccountVM = new AccountInformationViewModel(); AccountVM.leadId = leadId; var results = _service.GetAllAccountsForLead(leadId); AccountVM.accounts = results; var username = HttpContext.User.Identity.Name; AccountVM.user = _UserRepository.GetUserByUsername(username); // To check if any of the appointments in scored for displaying Create Account in AllAccountsforLead var scored = false; var appointmentforlead = _AppointmentSheetRepository.GetAppointmentByLeadId(leadId); foreach (var appointment in appointmentforlead) { if (appointment.Score == "Good" || appointment.Score == "Bad") { scored = true; break; } } AccountVM.Scored = scored; return(View(AccountVM)); }
public async Task <IActionResult> AccountInfo(AccountInformationViewModel model) { var user = await GetCurrentUserAsync(); /* * user.FirstName = model.FirstName; * user.LastName = model.LastName; */ getCartItems(); if (!ModelState.IsValid) { return(View(model)); } if (user != null) { var result = await _userManager.UpdateAsync(user); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent : false); user.FirstName = model.NewFirstName; user.LastName = model.NewLastName; _logger.LogInformation(3, "User updated profile successfully."); return(RedirectToAction(nameof(Index), new { Message = ManageMessageId.ProfileUpdate })); } AddErrors(result); return(View(model)); } return(RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error })); }
// GET: /AccountInfo/ public ActionResult AccountInformation(string id) { Response.Cookies.Remove("UserId"); // Account a = logic.Get(id); List <Membership> mems = a.Memberships.ToList(); List <TeamDisplay> teamDisplay = new List <TeamDisplay>(); foreach (Membership m in mems) { if (m.Status.IsMember()) { Team team = tLogic.Get(m.TeamId); TeamDisplay td = new TeamDisplay(team.Name, m.Status, team.Id); teamDisplay.Add(td); } } AccountInformationViewModel aivm = new AccountInformationViewModel(); aivm.Birthdate = a.Birthdate; aivm.EarnedBadges = EarnedBadges(a); aivm.FullName = a.FullName; aivm.Height = a.Height; aivm.PictureUrl = a.PictureUrl; aivm.PreferredName = a.PreferredName; aivm.Sex = a.Sex; aivm.Teams = teamDisplay; aivm.UnearnedBadges = UnearnedBadges(a); aivm.Weight = a.Weight; aivm.Zip = a.Zip; return(View(aivm)); }
public IActionResult accountTransaction(int accountId, int page) { var isAjax = Request.Headers["X-Requested-With"] == "XMLHttpRequest"; const int pagesize = 20; var query = _context.Transactions.Where(k => k.AccountId == accountId).OrderByDescending(p => p.TransactionId); var totalNumber = query.Count(); var transactions = query.Skip(pagesize * (page - 1)).Take(pagesize).ToList(); var modelTransaction = new AccountInformationViewModel { PageNumber = page, PageSize = pagesize, TotalNumberOfItems = totalNumber, CanShowMore = page * pagesize < totalNumber, Itransactions = transactions }; if (isAjax) { return(PartialView("_TransactionRows", modelTransaction)); } else { return(View(modelTransaction)); }; }
public IActionResult AccountInformation(int id) { var model = new AccountInformationViewModel(); model.accountInformation = _context.Accounts.Where(n => n.AccountId == id).ToList(); return(View(model)); }
public ActionResult Edit(Int32 AccountId) { Web.ViewModel.AccountInformationViewModel avm = new AccountInformationViewModel(); var username = HttpContext.User.Identity.Name; avm = GetAccountInformation(AccountId); avm.user = _UserRepository.GetUserByUsername(username); avm.tickets = _TicketRepository.GetTicketsByAccountID(AccountId); Lead accountlead = _LeadRepository.LeadByLeadID(avm.account.ParentLead); // int userid = acc.lead.AssignedAAUserId; User assignedaauser = new User(); assignedaauser = _UserRepository.GetUserById(accountlead.AssignedAAUserId); avm.assignedaa = assignedaauser; if (assignedaauser != null) { avm.AAName = assignedaauser.FirstName + " " + assignedaauser.LastName; } User assignedsauser = new User(); assignedsauser = _UserRepository.GetUserById(accountlead.AssignedSAUserId); avm.assignedsa = assignedsauser; if (assignedsauser != null) { avm.SAName = assignedsauser.FirstName + " " + assignedsauser.LastName; avm.EID = assignedsauser.FirstName.Substring(0, 1) + assignedsauser.LastName.Substring(0, 1) + "1000" + assignedsauser.UserId.ToString(); } var term = _EquipmentRepository.GetEquipmentByType("Terminal"); var pinpad = _EquipmentRepository.GetEquipmentByType("Pinpad"); var equip = _EquipmentRepository.GetEquipmentByType("Check"); IList <string> terms = new List <string>(); IList <string> pins = new List <string>(); IList <string> equips = new List <string>(); foreach (var t in term) { terms.Add(t.Name); } avm.terminals = avm.terminals.Concat(terms); foreach (var p in pinpad) { pins.Add(p.Name); } avm.pinpad = avm.pinpad.Concat(pins); foreach (var e in equip) { equips.Add(e.Name); } avm.equipment = avm.equipment.Concat(equips); return(View(avm)); }
public ActionResult AccountInformation(int AccountId) { //return View(GetAccountInformation(AccountId)); AccountInformationViewModel accountModel = new AccountInformationViewModel(); var results = _AccountRepository.GetAccountByAccountId(AccountId); accountModel.account = results; return(View(accountModel)); }
public async Task <IActionResult> Profile(ProfileViewModel model = null) { int _booksOnPage = 10; int page = 1; if (model != null && model.Pages != null) { page = model.Pages.PageNumber; } IdentityUser user = await _urm.FindByEmailAsync(User.Identity?.Name); List <string> roles = new List <string>(await _urm.GetRolesAsync(user)); AccountInformationViewModel account = new AccountInformationViewModel { Email = user.Email, Status = string.Join(", ", roles) }; IQueryable <int> bookId = _ctx.Favorites.AsNoTracking().Where(x => x.User == user).Select(b => b.BookId); List <BookDTO> books = _ctx.Books.AsNoTracking().Where(x => bookId.Contains(x.Id)).ToList(); await _ctx.SaveChangesAsync(); List <ShortBookViewModel> list = books.Skip((page - 1) * _booksOnPage) .Take(_booksOnPage).Select(bookDto => new ShortBookViewModel { Id = bookDto.Id, Title = bookDto.Title, Annotation = bookDto.Annotation, Author = _ctx.AuthorBook.AsNoTracking() .Where(x => x.BookId == bookDto.Id) .Select(pair => _ctx.Authors.AsNoTracking() .FirstOrDefault(a => a.Id == pair.AuthorId)) .ToList(), Genre = _ctx.GenreBook.AsNoTracking() .Where(x => x.BookId == bookDto.Id) .Select(pair => _ctx.Genres.AsNoTracking() .FirstOrDefault(g => g.Id == pair.GenreId)) .ToList(), Image = $"../../img/books/{bookDto.Id}/{Path.GetFileName(Directory.GetFiles($"{img_path}{bookDto.Id}")[0])}", NumberOfPages = bookDto.NumberOfPages, Popularity = bookDto.Popularity, Rating = bookDto.Rating, Series = bookDto.Series }).ToList(); return(View("Profile", new ProfileViewModel { Account = account, Favorites = list, Pages = new PaginationViewModel { PageNumber = page, TotalPages = books.Select(x => x.Id).Distinct().Count() / _booksOnPage } })); }
public ActionResult Account() { var user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <AppUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); var model = new AccountInformationViewModel() { FirstName = user.FirstName, LastName = user.LastName, Email = user.Email, Gender = user.Gender, PhoneNumber = user.PhoneNumber }; return(View(model)); }
public ActionResult Account(AccountInformationViewModel model) { if (ModelState.IsValid) { var user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <AppUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); user.FirstName = model.FirstName; user.LastName = model.LastName; user.Email = model.Email; user.InternalGender = (int)model.Gender; user.PhoneNumber = model.PhoneNumber; UserManager.Update(user); } return(View(model)); }
public ActionResult Index() { AccountInformationViewModel avm = new AccountInformationViewModel(); var username = HttpContext.User.Identity.Name; avm.user = _UserRepository.GetUserByUsername(username); var results = GetAllAccounts(); foreach (var result in results) { var salesagentid = result.AssignedSalesRep; User newUser = _UserRepository.GetUserById(salesagentid); if (newUser == null) { result.AssignedUser.UserName = "******"; } else { result.AssignedUser = newUser; } } //to get the SA dropdown IList <User> users = new List <User>(); var UsersResult = _UserRepository.GetAllUsers(); foreach (var result in UsersResult) { if (result.AssignedRoleId == 3) { users.Add(result); } } avm.SAUsersDropdown = users.Select(row => new SelectListItem() { Text = row.FirstName + " " + row.LastName, Value = row.UserId.ToString() }); avm.Account = results; return(View(avm)); }
public async Task <JsonResult> Save(Models.ProfilePage currentPage, AccountInformationViewModel viewModel) { var user = await CustomerService.GetSiteUserAsync(User.Identity.Name); var contact = CustomerService.GetCurrentContact(); user.FirstName = contact.FirstName = viewModel.FirstName; user.LastName = contact.LastName = viewModel.LastName; contact.Contact.BirthDate = viewModel.DateOfBirth; user.NewsLetter = viewModel.SubscribesToNewsletter; UserManager.UpdateAsync(user) .GetAwaiter() .GetResult(); contact.SaveChanges(); return(Json(new { contact.FirstName, contact.LastName })); }
public AccountInformationViewModel GetAccountInformation(long accountId) { var accountInformationModel = new GetAccountInformationQueryHandler(new DataBaseContext()).Handle(new GetAccountInformationQuery { AccountId = accountId }); if (accountInformationModel == null) { return(new AccountInformationViewModel()); } var result = new AccountInformationViewModel { CountCurrentFriends = accountInformationModel.AccountInformationData != null ? accountInformationModel.AccountInformationData.CountCurrentFriends : 0, CountNewMessages = accountInformationModel.AccountInformationData != null ? accountInformationModel.AccountInformationData.CountNewMessages : 0, CountIncommingFriendsRequest = accountInformationModel.AccountInformationData != null ? accountInformationModel.AccountInformationData.CountIncommingFriendsRequest : 0 }; return(result); }
public AccountInformationViewModel GetAccountInformation(int AccountID) { AccountInformationViewModel accountModel = new AccountInformationViewModel(); var results = _AccountRepository.GetAccountByAccountId(AccountID); var salesagentid = results.AssignedSalesRep; User newUser = _UserRepository.GetUserById(salesagentid); if (newUser == null) { results.AssignedUser.UserName = "******"; } else { results.AssignedUser = newUser; } accountModel.account = results; //var aaUsersResult = _UserRepository.Users.Where(row => row.AssignedRole.Permissions.Contains(new Permission()) == true); //var aaUsersResult = _UserRepository.GetAllUsersByPermission(Data.Constants.Permissions.LEAD_ASSIGNABLE); return(accountModel); }