예제 #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            //get current user data
            var claimsIdentity = (ClaimsIdentity)User.Identity;
            var claim          = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);

            //pass to form to provide UpdatedBy data
            CurrentUserId = claim.Value;

            //get all mentor assignments for the current logged in user/mentor
            var mentorAssignments = _repository.GetCurrentMentorAssignments(CurrentUserId);
            var iterations        = await _repository.GetMentorAssignmentIterationPairsAsync(mentorAssignments);

            foreach (var assignment in mentorAssignments)
            {
                assignment.Application.DropDownName = assignment.Application.CompanyName + " - " + iterations[assignment.MentorAssignmentId];
            }


            //create dropdown
            ViewData["MentorAssignmentId"] = new SelectList(mentorAssignments, "MentorAssignmentId", "Application.DropDownName");

            //set datetime for default date on form
            MentorNote = new MentorNote()
            {
                MeetingDate = DateTime.Now
            };

            return(Page());
        }
예제 #2
0
        /**
         * This helper method returns the file attachment for the given mentor note id
         */
        public IActionResult OnPostDownload(int noteId)
        {
            //get mentor note in question
            MentorNote mentorNote = _context.MentorNote.Where(x => x.MentorNoteId == noteId).FirstOrDefault();
            //get local path
            string webRootPath = _hostingEnvironment.WebRootPath;

            //use helper method to get file byte array
            byte[] fileBytes = GetFile(webRootPath + mentorNote.MentorNoteFileAttachment);

            //retrieve original file name to display
            string filePathOriginal = mentorNote.MentorNoteFileAttachment;

            string[] nameArray       = filePathOriginal.Split("$&$%");
            string   fileDisplayName = nameArray[1];

            return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileDisplayName));
        }
예제 #3
0
        public void AddApplication()
        {
            /*
             * var app1 = new Application()
             * {
             *  ApplicantId = "8a89b953-3a97-4a64-90f3-4e3061e08691",
             *  ApplicationStatusId = 4,
             *  CompanyName = "Bob's Burgers",
             *  ApplicationCreationDate = DateTime.Now,
             *  UpdatedBy = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
             *  UpdatedDate = DateTime.Now,
             *  IsArchived = false
             * };
             *
             * _context.Application.Add(app1);
             *
             *
             * var app2 = new Application()
             * {
             *  ApplicantId = "8a89b953-3a97-4a64-90f3-4e3061e08691",
             *  ApplicationStatusId = 4,
             *  CompanyName = "Stickers for Men",
             *  ApplicationCreationDate = DateTime.Now,
             *  UpdatedBy = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
             *  UpdatedDate = DateTime.Now,
             *  IsArchived = false
             * };
             *
             * _context.Application.Add(app2);
             * _context.SaveChanges();
             */

            var note1 = new MentorNote()
            {
                MentorAssignmentId = 13,
                MeetingDate        = Convert.ToDateTime("10/15/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            var note2 = new MentorNote()
            {
                MentorAssignmentId = 14,
                MeetingDate        = Convert.ToDateTime("10/16/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            var note3 = new MentorNote()
            {
                MentorAssignmentId = 15,
                MeetingDate        = Convert.ToDateTime("10/17/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            var note4 = new MentorNote()
            {
                MentorAssignmentId = 13,
                MeetingDate        = Convert.ToDateTime("10/20/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            var note5 = new MentorNote()
            {
                MentorAssignmentId = 13,
                MeetingDate        = Convert.ToDateTime("10/25/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            var note6 = new MentorNote()
            {
                MentorAssignmentId = 14,
                MeetingDate        = Convert.ToDateTime("10/19/2020"),
                Notes       = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lorem arcu, varius ultrices turpis nec, vulputate dapibus lacus. Sed consequat quis lectus vitae cursus.",
                UpdatedBy   = "c8fd0d0f-6360-4c55-bc82-b7f24b69130b",
                UpdatedDate = DateTime.Now
            };

            _context.MentorNote.Add(note1);
            _context.MentorNote.Add(note2);
            _context.MentorNote.Add(note3);
            _context.MentorNote.Add(note4);
            _context.MentorNote.Add(note5);
            _context.MentorNote.Add(note6);
            _context.SaveChanges();
        }