Example #1
0
        public ActionResult UniversityPartial()
        {
            var details    = _universityDetailsProvider.GetUniversity();
            var university = new UniversityViewModel
            {
                Address = details.Address,
                Name    = details.Name
            };

            return(PartialView("Partials/_university", university));
        }
Example #2
0
        public FileResult Download(int id)
        {
            var    student     = _studentsProvider.GetStudent(id);
            var    course      = student.Course;
            var    university  = _universityDetailsProvider.GetUniversity();
            var    employee    = _employeesProvider.GetEmployee(User.Identity.Name);
            var    template    = course.Template;
            string contentType = course.Template.ContentType;

            var    path         = Path.Combine(Server.MapPath("~/App_Data/templates"), template.FilePath);
            string fileName     = string.Format("{0} {1}.{2}.docx", student.FirstName, student.LastName, course.Name);
            var    contractPath = Path.Combine(Server.MapPath("~/App_Data/contracts"), fileName);

            _contractGenerator.Generate(path, contractPath, student, university, employee);

            return(File(contractPath, contentType, fileName));
        }