// GET: Project Detail page. public ActionResult Detail(string id, string type) { ProjectVM viewModel = new ProjectVM(); List<SelectListItem> statusDropDownList = _projectHandler.GetAllStatus(); List<SelectListItem> roleDropDownList = _projectHandler.GetRoles(); // Edit page if (type == "E") { // Set DropDown List. for (int i = 0; i < statusDropDownList.Count; i++) { if (statusDropDownList[i].Value == id) { statusDropDownList[i].Selected = true; } } // Set Project View Model. viewModel = _projectHandler.GetProjectWithId(int.Parse(id)); } // Set ViewBag. ViewBag.PageType = type; ViewBag.StatusDropDownList = statusDropDownList; ViewBag.RoleDropDownList = roleDropDownList; return View(viewModel); }
public List<ProjectVM> GetProjectTable() { List<ProjectVM> result = new List<ProjectVM>(); List<ProjectModel> projectModel = _projectDataAccess.GetProject(); foreach(ProjectModel model in projectModel) { ProjectVM viewModel = new ProjectVM(); viewModel.Id = model.Id.ToString(); viewModel.Name = model.Subject; viewModel.SourceRespository = model.SourceRespository; viewModel.ReleasedVersion = model.ReleasedVersion; viewModel.StatusDropDownList = GetStatus(model.Status); result.Add(viewModel); } return result; }
public ActionResult SaveProject(ProjectVM viewModel) { int statusCode = _projectHandler.UpsertProject(viewModel); StatusMessage statusMessage = CommonHandler.GetStatusMessage(statusCode); return Json(new { code = statusMessage.Code, msg = statusMessage.Message }, JsonRequestBehavior.AllowGet); }
public ProjectVM GetProjectWithId(int id) { ProjectVM result = new ProjectVM(); ProjectModel model = _projectDataAccess.GetProjectWithId(id); result.Id = model.Id.ToString(); result.Name = model.Subject; result.Description = model.Description; result.SourceRespository = model.SourceRespository; result.ReleasedVersion = model.ReleasedVersion; result.Description = model.Description; return result; }
public int UpsertProject(ProjectVM viewModel) { ProjectModel model = new ProjectModel(); model.Id = int.Parse(viewModel.Id); model.Subject = viewModel.Name; model.ReleasedVersion = viewModel.ReleasedVersion; model.SourceRespository = viewModel.SourceRespository; model.Description = viewModel.Description; model.Status = int.Parse(viewModel.StatusDropDownList); model.UpdatedTimeStamp = DateTime.Now; return _projectDataAccess.UpsertProject(model); }