public IActionResult NewView() { var projectNewViewModel = new ProjectNewViewModel { Users = GetAllUsers().Result.Users, Roles = GetAllRoles().Result.Roles }; return(View(projectNewViewModel)); }
// // GET: /Projects/Create public ActionResult Create() { //ViewBag.PossibleGroups = groupRepository.All; ProjectNewViewModel newModel = new ProjectNewViewModel { Project = new Project(), Groups = groupRepository.All, Tags = tagRepository.All, }; return View(newModel); }
public ProjectNewView(SolutionModel solution, SolutionFolderModel folder) { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = new ProjectNewViewModel(solution, folder); DataContext = ViewModel; ViewModel.Close += (sender, result) => { DialogResult = result.IsAccepted; Close(); }; }
public ProjectNewView(ProjectNewViewModel projectNewViewModel) { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = projectNewViewModel; DataContext = ViewModel; ViewModel.Close += (sender, result) => { DialogResult = result.IsAccepted; Close(); }; }
public ActionResult Create(ProjectNewViewModel ProjectVM) { if (ModelState.IsValid) { projectRepository.InsertOrUpdate(ProjectVM.Project); projectRepository.Save(); return RedirectToAction("Index"); } else { //ViewBag.PossibleGroups = groupRepository.All; ProjectVM.Groups = groupRepository.All; ProjectVM.Tags = tagRepository.All; return View(ProjectVM); } }
public async Task <ProjectNewViewModel> GetAllRoles() { HttpClient client = _api.Initial(); HttpResponseMessage res = await client.GetAsync("api/rolesApi"); var projectNewViewModel = new ProjectNewViewModel(); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; var roleSelectList = JsonConvert.DeserializeObject <IEnumerable <Role> >(result).Select(a => new SelectListItem { Text = a.RoleName, Value = a.RoleId.ToString() }); projectNewViewModel.Roles = new SelectList(roleSelectList, "Value", "Text"); } return(projectNewViewModel); }
public ActionResult Create(ProjectNewViewModel vm) { try { Project project = new Project() { Active = vm.Active, CreatedDate = vm.CreatedDate, Name = vm.Name }; BLL.CreateNewProject(project); return(RedirectToAction("GetTlProjects")); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View()); } }
public IActionResult NewView(ProjectNewViewModel projectNewViewModel, string projectTitle, string projectDescription, DateTime dueDate, string estimatedHours ) { return(View(projectNewViewModel)); }
// // GET: /Projects/Edit/5 public ActionResult Edit(int id) { ViewBag.PossibleGroups = groupRepository.All; ProjectNewViewModel newModel = new ProjectNewViewModel { Project = projectRepository.Find(id), Groups = groupRepository.All, Tags = tagRepository.All, }; return View(newModel); }
public ActionResult EditProject( ProjectNewViewModel ProjectVM) { //load project from repo //call tryupdatemodel on the Project //int pID = int.Parse(collection["Project.ProjectId"]); //var pvm = new ProjectNewViewModel(); ////pvm.Project = projectRepository.Find(pID); //try{ // if(TryUpdateModel(pvm)) // { // UpdateModel(pvm); // } //} //catch(DataException){ // ModelState.AddModelError("", "unable to update project"); // return View(); //} if (ModelState.IsValid) { projectRepository.InsertOrUpdate(ProjectVM.Project); projectRepository.Save(); return RedirectToAction("Index"); } else { ViewBag.PossibleGroups = groupRepository.All; return View(); } }