// GET: Commitments/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var model = new EditCommitmentViewModel();

            var commitment = await _context.Commitment
                             .Include(u => u.UserProfile)
                             .SingleOrDefaultAsync(m => m.Id == id);

            if (commitment == null)
            {
                return(NotFound());
            }

            model.Id                    = commitment.Id;
            model.Title                 = commitment.Title;
            model.Description           = commitment.Description;
            model.Status                = commitment.Status;
            model.SelectedUserID        = commitment.UserProfileId;
            model.SelectedLeadMeasureId = commitment.LeadMeasureId;
            model.DateCreated           = commitment.DateCreated;
            model.Users                 = await _context.UserProfile.ToListAsync();

            model.LeadMeasures = await _context.LeadMeasure
                                 .Include(w => w.Wig)
                                 .ToListAsync();

            return(View(model));
        }
Example #2
0
        public ActionResult Edit(EditCommitmentViewModel model)
        {
            var id = businessManagerContainer.Get <CommitmentBusinessManager>().Update(model.Id, model);

            return(RedirectToAction("Details", new { id }));
        }