public ProjectDetailsView Handle() { var project = _context.Projects.First(p => p.Id == ProjectId); var view = new ProjectDetailsView { Id = project.Id, Name = project.Name, PublicationDate = project.PublicationDate, }; return(view); }
public ActionResult AddOrUpdate([Bind(Include = "Id, Name, ShortName, Description, IssuesOfProject")] ProjectDetailsView project) { _logger.Info($"POST Project/AddOrUpdate {project}"); project.IssuesOfProject = Mapper.Map <List <IssueInListView> >(Session["runtimeIssues"]); if (!ModelState.IsValid) { return(View("Edit", project)); } try { _projectService.AddOrUpdateProject(Mapper.Map <ProjectDto>(project)); } catch (ValidationException ex) { foreach (var invalidField in ex.InvalidFieldsWithMessages) { ModelState.AddModelError(invalidField.Key, invalidField.Value); } return(View("Edit", project)); } catch (EntityNotFoundException ex) { _logger.Warn(ex.Message); ViewBag.Error = ex.Message; return(View("Edit", project)); } _logger.Info($"Project {project} successfully added/updated"); return(RedirectToAction(actionName: "List")); }
public void ProcessCreateNewProject() { var newProject = new ProjectDTO() { ProjectName = "<Enter name>" }; var view = new ProjectDetailsView(); view.Object = newProject; var popup = new PopupWindow(); popup.Title = "New Project"; popup.ViewPanel.Children.Add(view); if (popup.ShowDialog() == true) { using (var proxy = new DarwinServiceReference.DarwinDataServiceClient()) { proxy.SaveObject(new SaveObjectRequest(newProject)); } } }
public void ProcessShowProjectTreeNodeDetails() { var serviceLocator = ServiceLocator.GetActive(); serviceLocator.SessionState.ValidationErrors.Clear(); serviceLocator.SessionState.ObjectInEditor = null; var node = new ProjectTreeHelper().GetCurrentNode(); if (node == null) { serviceLocator.SessionState.DetailsPanel.Children.Clear(); serviceLocator.SessionState.DetailsView = null; return; } IDetailsView view = null; var persistentObject = node.Object as PersistentObjectDTO; if (persistentObject != null) { if (persistentObject.PersistentType == typeof(Entity)) { view = new EntityDetailsView(); } else if (persistentObject.PersistentType == typeof(Project)) { view = new ProjectDetailsView(); } else if (persistentObject.PersistentType == typeof(Database)) { view = new DatabaseDetailsView(); } else if (persistentObject.PersistentType == typeof(ERModel.Attribute)) { view = new AttributeDetailsView(); } else if (persistentObject.PersistentType == typeof(DataType)) { view = new DataTypeDetailsView(); } else if (persistentObject.PersistentType == typeof(Relation)) { view = new RelationDetailsView(); } else if (persistentObject.PersistentType == typeof(RelationItem)) { view = new RelationItemDetailsView(); } else if (persistentObject.PersistentType == typeof(Diagram)) { view = new DiagramChartView(); } else if (persistentObject.PersistentType == typeof(DiagramEntity)) { view = new DiagramEntityDetailsView(); } else if (persistentObject.PersistentType == typeof(BaseEnum)) { view = new BaseEnumDetailsView(); } else if (persistentObject.PersistentType == typeof(BaseEnumValue)) { view = new BaseEnumValueDetailsView(); } if (view != null) { view.Object = persistentObject; } } serviceLocator.SessionState.DetailsPanel.Children.Clear(); serviceLocator.SessionState.DetailsView = view; serviceLocator.SessionState.ObjectInEditor = persistentObject; if (view != null) { serviceLocator.SessionState.DetailsPanel.Children.Add(view as UIElement); } }