Skip to content

Instantly share code, notes, and snippets.

@PadreSVK
Last active November 6, 2018 15:17
Show Gist options
  • Save PadreSVK/0c04fb117fa3f55b44ef59e72346780b to your computer and use it in GitHub Desktop.
Save PadreSVK/0c04fb117fa3f55b44ef59e72346780b to your computer and use it in GitHub Desktop.
Project detail before add change manager functionality
@viewModel DotVVM.Samples.NestedViewModel.ViewModels.Projects.ProjectDetailViewModel, DotVVM.Samples.NestedViewModel
@masterPage Views/MasterPage.dotmaster
<dot:Content ContentPlaceHolderID="MainContent">
<div DataContext="{value: Project}">
<h1 InnerText="{value: Title}" />
<small InnerText="{value: Manager.FullName}" />
<p InnerText="{value: Description}" />
</div>
</dot:Content>
using DotVVM.Framework.ViewModel;
using DotVVM.Samples.NestedViewModel.DAL.Entities;
using DotVVM.Samples.NestedViewModel.Services;
using Task = System.Threading.Tasks.Task;
namespace DotVVM.Samples.NestedViewModel.ViewModels.Projects
{
public class ProjectDetailViewModel : MasterPageViewModel
{
private readonly ProjectService _projectService;
public ProjectDetailViewModel(ProjectService projectService)
{
_projectService = projectService;
}
[FromRoute(nameof(Id))] public int Id { get; set; }
public Project Project { get; set; }
public override Task Load()
{
if (!Context.IsPostBack)
{
Project = _projectService.GetById(Id);
}
return base.Load();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment