Пример #1
0
 public void IncorporateUpdates(AssignmentEdit vm)
 {
     Description = vm.Description;
     DueDate = vm.DueDate;
     IsActive = vm.IsActive;
     OwnerID = vm.OwnerID;
     Title = vm.Title;
     TopicID = vm.TopicID;
     Type = vm.Type;
 }
		// GET: Assignments/Edit/5
		public ActionResult Edit(int? id)
		{
			if (id == null)
				return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

			Assignment assignment = db.Assignments.Find(id);

			if (assignment == null)
				return HttpNotFound();

			if (IsTopicLocked(assignment.TopicID))
				throw new TopicLockedException();

			ViewBag.UserList = CreateUserSelectList();

			var vm = new AssignmentEdit
			{
				Description = assignment.Description,
				DueDate = assignment.DueDate,
				ID = assignment.ID,
				OwnerID = assignment.OwnerID,
				Title = assignment.Title,
				TopicID = assignment.TopicID,
				Type = assignment.Type,
				IsActive = assignment.IsActive
			};

			return View(vm);
		}
Пример #3
0
 public static Assignment FromViewModel(AssignmentEdit vm)
 {
     var a = new Assignment();
     a.IncorporateUpdates(vm);
     a.IsDone = false;
     a.ReminderSent = false;
     return a;
 }
		public ActionResult Create(int topicID)
		{
			if (IsTopicLocked(topicID))
				throw new TopicLockedException();

			var a = new AssignmentEdit
			{
				TopicID = topicID,
				OwnerSelectList = CreateOwnerSelectListitems()
			};

			return View(a);
		}