summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsotoudeh <matthewsot@outlook.com>2015-04-26 11:46:17 -0700
committermatthewsotoudeh <matthewsot@outlook.com>2015-04-26 11:46:17 -0700
commit46936ab048c3cf7308fe8b4a9c71a3d04963b96a (patch)
treec394d410f454a574279d2a4223d33d1068ce4bd7
parente89e7a00e0436ebd04fd0a16ee46f08afae6bc62 (diff)
create the AutoMapper maps
-rw-r--r--LHSCamp/LHSCamp/Controllers/CandidatesController.cs3
-rw-r--r--LHSCamp/LHSCamp/Controllers/WelcomeController.cs1
2 files changed, 4 insertions, 0 deletions
diff --git a/LHSCamp/LHSCamp/Controllers/CandidatesController.cs b/LHSCamp/LHSCamp/Controllers/CandidatesController.cs
index 98819ea..3880dea 100644
--- a/LHSCamp/LHSCamp/Controllers/CandidatesController.cs
+++ b/LHSCamp/LHSCamp/Controllers/CandidatesController.cs
@@ -60,7 +60,9 @@ namespace LHSCamp.Controllers
cand.ToString();
}
+ Mapper.CreateMap<Candidate, CandidateViewModel>();
positionModel.Candidates = Mapper.Map<List<Candidate>, List<CandidateViewModel>>(candidates);
+
model.Positions.Add(positionModel);
}
@@ -77,6 +79,7 @@ namespace LHSCamp.Controllers
candidate.ViewCount = candidate.ViewCount + 1;
db.SaveChanges();
+ Mapper.CreateMap<Candidate, CandidateViewModel>();
var model = Mapper.Map<Candidate, CandidateViewModel>(candidate);
return View(model);
diff --git a/LHSCamp/LHSCamp/Controllers/WelcomeController.cs b/LHSCamp/LHSCamp/Controllers/WelcomeController.cs
index 692b823..5213dcd 100644
--- a/LHSCamp/LHSCamp/Controllers/WelcomeController.cs
+++ b/LHSCamp/LHSCamp/Controllers/WelcomeController.cs
@@ -22,6 +22,7 @@ namespace LHSCamp.Controllers
return RedirectToAction("GetClass", "Candidates");
}
+ Mapper.CreateMap<Candidate, CandidateViewModel>();
var model = Mapper.Map<Candidate, CandidateViewModel>(candidate);
if (TempData.ContainsKey("Uploaded"))
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback