Пример #1
0
        public ActionResult App(FormCollection form)
        {
            var cmsStudentId = form["CmsStudentId"];
            //we're allowing them to create a new application with their CmsStudentId
            var model = _interns.LoadByCode(cmsStudentId) ?? _interns.Create(cmsStudentId);

            try
            {
                if (TryUpdateModel(model, null, null, new[] { "CmsStudentId", "Essay", "Resume", "Recommendation1", "Recommendation2" }))
                {
                    model.Submitted = DateTime.Now;
                    _interns.Save(model); //we need an ID for the files below
                    _interns.UploadEssay(model, Request.Files["Essay"]);
                    _interns.UploadResume(model, Request.Files["Resume"]);
                    _interns.UploadRecommendation1(model, Request.Files["Recommendation1"]);
                    _interns.UploadRecommendation2(model, Request.Files["Recommendation2"]);
                    _interns.Save(model);
                    return(Content("Application Submitted", "text/plain"));
                }
            }
            catch (Exception ex)
            {
                ViewData.Error(ex);
            }
            return(View(model));
        }