/// <summary> /// Convert VoteProject to VoteProjectModel /// </summary> /// <param name="voteproject"></param> /// <returns></returns> private VoteProjectModel ConvertProjectToModel(VoteProject voteproject) { VoteProjectModel vpModel = new VoteProjectModel(); vpModel.Id = voteproject.Id; vpModel.Name = voteproject.Name; vpModel.TermFrom = Convert.ToDateTime(voteproject.TermFrom); vpModel.TermTo = Convert.ToDateTime(voteproject.TermTo); vpModel.State = voteproject.State; vpModel.VoteNum = voteproject.VoteNum; vpModel.BeginTime = Convert.ToDateTime(voteproject.BeginTime); vpModel.EndTime = Convert.ToDateTime(voteproject.EndTime); return vpModel; }
public ActionResult VoteProjectEdit(int id) { VoteProjectModel vpModel = new VoteProjectModel(); VoteProject voteproject = db.VoteProjects.Find(id); if (vpModel == null) { return HttpNotFound(); } //Convert VoteProject to VoteProjectModel vpModel = ConvertProjectToModel(voteproject); return View(vpModel); }