public virtual ActionResult Index() { var user = _studentRepository.GetById(_httpContextService.GetUserId()); var userModel = Mapper.Map <Index>(user); return(View(MVC.Student.Views.ViewNames.Index, userModel)); }
public virtual ActionResult Index() { var user = _coordinatorRepository.GetById(_httpContextService.GetUserId()); var userModel = Mapper.Map <ViewModels.Coordinator.Index>(user); return(View(MVC.Coordinator.Views.ViewNames.Index, userModel)); }
// GET: Enterprise public virtual ActionResult Index() { var notifications = _notificationService.GetDashboardNotificationForUser(_httpContext.GetUserId()); var notificationsViewModels = Mapper.Map <IEnumerable <ViewModels.Notification.Notification> >(notifications).ToList(); return(View(notificationsViewModels)); }
public virtual ActionResult Index() { var user = _employeeRepository.GetById(_httpContextService.GetUserId()); var userModel = new Index() { TotalApplicationsCount = _employeeService.FetchTotalNumberOfApplications(user.Id), RefusedOffersCount = _employeeService.FetchTotalNumberOfRefusedOffers(user.Id), OnValidationOffersCount = _employeeService.FetchTotalNumberOfOnValidationOffers(user.Id), PublishedOffersCount = _employeeService.FetchTotalNumberOfPublishedOffers(user.Id) }; return(View(MVC.Employee.Views.ViewNames.Index, userModel)); }
public virtual ActionResult InviteCompanies(InviteCompanies inviteCompaniesVm) { var coordinator = _coordinatorRepository.GetById(_httpContextService.GetUserId()); var employees = _employeeRepository.GetAll().ToList(); if (!ModelState.IsValid) { return(View(MVC.InviteCompanies.Views.ViewNames.InviteCompanies)); } foreach (var employee in employees) { try { var mail = _emailService.BuildMail(employee.Identifier, coordinator.Identifier, inviteCompaniesVm.Subject, inviteCompaniesVm.Body); _emailService.SendEmail(mail); } catch (Exception) { var errorMessage = WebMessage.InviteCompaniesMessage.GENERIC_INVITE_COMPANIES_ERROR; return(View(MVC.InviteCompanies.Views.ViewNames.InviteCompanies).Error(errorMessage)); } } return(RedirectToAction(MVC.Coordinator.Views.ViewNames.Index, MVC.Coordinator.Name).Success(WebMessage.InviteCompaniesMessage.INVITE_COMPANIES_SUCCES)); }
public virtual ActionResult Create(ReviewCreateViewModel reviewCreateViewModel) { if (ModelState.IsValid) { var writerId = _httpContextService.GetUserId(); var writer = _writerRepository.GetById(writerId); //Todo: faire la map var review = new Review() { WriterId = writer.Id, RestaurantId = reviewCreateViewModel.RestaurantId, Body = reviewCreateViewModel.Body, Rating = reviewCreateViewModel.Rating }; writer.Reviews.Add(review); _writerRepository.Update(writer); return(RedirectToAction(MVC.Home.Index())); } PopulateRestaurantSelectList(reviewCreateViewModel); return(View(reviewCreateViewModel)); }
public virtual ActionResult NotificationIndex() { const int NUMBER_NOTIF_MAX = 10; var userId = _httpContextService.GetUserId(); var currentUser = _applicationUserRepository.GetById(userId); var notifications = Mapper.Map <IEnumerable <ViewModels.Notification.Notification> >(currentUser.Notifications .OrderByDescending(x => x.Time.Date) .ThenByDescending(x => x.Time.TimeOfDay)); if (notifications.Count() > NUMBER_NOTIF_MAX) { var shortNotif = notifications.Take(NUMBER_NOTIF_MAX); return(PartialView("_MenuPartial", shortNotif)); } return(PartialView("_MenuPartial", notifications)); }
public virtual ActionResult Create() { var interview = new ViewModels.Interviews.Create(); var userId = _httpContextService.GetUserId(); var applies = _applyRepository.GetAll().Where(x => x.IdStudent == userId).ToList(); interview.Apply = from apply in applies select new SelectListItem { Text = _stageRepository.GetById(apply.IdStage).StageTitle + " - " + _stageRepository.GetById(apply.IdStage).CompanyName, Value = apply.IdStage.ToString() }; var applis = interview.Apply.ToList(); return(View(interview)); }
public virtual ActionResult Edit() { var employee = _employeeRepository.GetById(_httpContextService.GetUserId()); if (employee == null) { return(HttpNotFound()); } var company = _companyRepository.GetById(employee.CompanyId); if (company == null) { return(HttpNotFound()); } var viewModel = Mapper.Map <ViewModels.Company.Edit>(company); return(View(viewModel)); }
public virtual ActionResult EmployeeIndex() { var employee = _employeeRepository.GetById(_httpContextService.GetUserId()); var internshipOffers = _internshipOfferRepository.GetAll() .Where(offer => offer.CompanyId == employee.CompanyId).ToList(); var internshipOfferIndexViewModels = Mapper.Map <IEnumerable <ViewModels.InternshipOffer.Index> >(internshipOffers); ViewBag.PublicatedOffersOnly = false; return(View(MVC.InternshipOffer.Views.ViewNames.Index, internshipOfferIndexViewModels)); }
public virtual ActionResult CreateConfirmation(int idApply) { var apply = _applyRepository.GetById(idApply); var stageAgreement = new StageAgreement(); stageAgreement.IdStage = apply.IdStage; stageAgreement.IdStudentSigned = apply.IdStudent; stageAgreement.IdCoordinatorSigned = _httpContextService.GetUserId(); _stageAgreementRepository.Add(stageAgreement); string stageTitle = _stageRepository.GetById(stageAgreement.IdStage).StageTitle; string enterpriseName = _stageRepository.GetById(stageAgreement.IdStage).CompanyName; string message = String.Format(CoordinatorToContactEnterprise.StageAgreementCreatedMessage, stageTitle); _notificationService.SendNotificationToAllContactEnterpriseOf(enterpriseName, CoordinatorToContactEnterprise.StageAgreementCreatedTitle, message); _notificationService.SendNotificationToAllCoordinator( CoordinatorToContactEnterprise.StageAgreementCreatedTitle, message); _notificationService.SendNotificationTo(stageAgreement.IdStudentSigned, CoordinatorToContactEnterprise.StageAgreementCreatedTitle, message); return(View()); }
public void create_post_should_add_writer_review_to_repository() { // Arrange var review = _fixture.Create <Review>(); var reviewViewModel = Mapper.Map <Create>(review); _httpContextService.GetUserId().Returns(review.WriterId); // Action _reviewController.Create(reviewViewModel); // Assert ReviewRepositoryAddMethodShouldHaveReceived(review); }
public virtual ActionResult ViewStageInfo(int id) { var stage = _stageRepository.GetById(id); var student = _studentRepository.GetById(_httpContextService.GetUserId()); if (stage != null && stage.Status == StageStatus.Accepted) { var stageInfoViewModel = Mapper.Map <ViewModels.Stage.ViewInfo>(stage); stageInfoViewModel.HadStage = student.hadStage; return(View(stageInfoViewModel)); } return(HttpNotFound()); }
public virtual ActionResult Details() { var userID = _httpContext.GetUserId(); var account = _accountRepository.GetById(userID); var details = Mapper.Map <Details>(account); if (account == null) { return(HttpNotFound()); } return(View(details)); }
public virtual ActionResult Create(Create create) { if (ModelState.IsValid) { var review = Mapper.Map <Review>(create); review.WriterId = _httpContextService.GetUserId(); _reviewRepository.Add(review); return(RedirectToAction(MVC.Home.Index())); } PopulateRestaurantSelectList(create); return(View(create)); }
private void UserNotification(int userId, string message, string linkControllerName, string linkMethodName) { var notification = new Notification() { Object = message, SenderId = _httpContext.GetUserId(), ReceiverId = userId, Unseen = true, Time = DateTime.Now, LinkAction = linkMethodName, LinkController = linkControllerName }; _notificationRepository.Add(notification); }
public virtual ActionResult Detail(int id) { var notification = _notificationService.GetNotification(id); if (notification != null) { var notificationViewModel = Mapper.Map <ViewModels.Notification.Detail>(notification); if (notification.For != _httpContextService.GetUserId()) { return(RedirectToAction(MVC.Notification.Error())); } notification.Seen = true; _notificationService.MarkNotificationAsSeen(notification); return(View(notificationViewModel)); } return(HttpNotFound()); }
public virtual ActionResult StudentApplicationIndex() { var studentId = _httpContext.GetUserId(); return(this.GetApplicationsForSpecificStudent(studentId)); }