Пример #1
0
        /// <summary>
        /// A function that displays the view used to create a new assignment
        /// </summary>
        public ActionResult Create(int id)
        {
            #region Security
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }
            #endregion

            AssignmentViewModel viewModel = new AssignmentViewModel();
            viewModel.CourseID   = id;
            viewModel.Milestones = new List <AssignmentMilestoneViewModel>();
            AssignmentMilestoneViewModel milestone = new AssignmentMilestoneViewModel {
                Title = "", AssignmentID = id
            };
            viewModel.Milestones.Add(milestone);
            viewModel.programmingLanguages = assignmentService.GetProgrammingLanguages();
            viewModel.DueDate     = DateTime.Now;
            viewModel.DateCreated = DateTime.Now;
            return(View(viewModel));
        }