// GET: ProjectTasks
public ActionResult Index()
{
- var projectTasks = db.ProjectTasks.Include(p => p.Project).Include(p => p.TaskStatus).Include(p => p.ProjectUser);
+ var projectTasks = db.ProjectTasks.Include(p => p.Project).Include(p => p.TaskStatus).Include(p => p.User);
return View(projectTasks.ToList());
}
{
ViewBag.project_id = new SelectList(db.Projects, "id", "name");
ViewBag.task_status_id = new SelectList(db.TaskStatuses, "int", "status");
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login");
+ ViewBag.user_id = new SelectList(db.Users, "id", "login");
return View();
}
ViewBag.project_id = new SelectList(db.Projects, "id", "name", projectTask.project_id);
ViewBag.task_status_id = new SelectList(db.TaskStatuses, "int", "status", projectTask.task_status_id);
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", projectTask.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", projectTask.user_id);
return View(projectTask);
}
}
ViewBag.project_id = new SelectList(db.Projects, "id", "name", projectTask.project_id);
ViewBag.task_status_id = new SelectList(db.TaskStatuses, "int", "status", projectTask.task_status_id);
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", projectTask.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", projectTask.user_id);
return View(projectTask);
}
}
ViewBag.project_id = new SelectList(db.Projects, "id", "name", projectTask.project_id);
ViewBag.task_status_id = new SelectList(db.TaskStatuses, "int", "status", projectTask.task_status_id);
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", projectTask.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", projectTask.user_id);
return View(projectTask);
}
// GET: Projects
public ActionResult Index()
{
- var projects = db.Projects.Include(p => p.ProjectUser);
+ var projects = db.Projects.Include(p => p.User);
return View(projects.ToList());
}
// GET: Projects/Create
public ActionResult Create()
{
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login");
+ ViewBag.user_id = new SelectList(db.Users, "id", "login");
return View();
}
return RedirectToAction("Index");
}
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", project.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", project.user_id);
return View(project);
}
{
return HttpNotFound();
}
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", project.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", project.user_id);
return View(project);
}
db.SaveChanges();
return RedirectToAction("Index");
}
- ViewBag.user_id = new SelectList(db.ProjectUsers, "id", "login", project.user_id);
+ ViewBag.user_id = new SelectList(db.Users, "id", "login", project.user_id);
return View(project);
}
public Nullable<System.DateTime> updated_at;
}
- public class ProjectUserMetadata
+ public class UserMetadata
{
[Display(Name = "Login")]
public string login;
public virtual DbSet<Project> Projects { get; set; }
public virtual DbSet<ProjectTask> ProjectTasks { get; set; }
- public virtual DbSet<ProjectUser> ProjectUsers { get; set; }
public virtual DbSet<sysdiagram> sysdiagrams { get; set; }
public virtual DbSet<TaskStatus> TaskStatuses { get; set; }
+ public virtual DbSet<UserRole> UserRoles { get; set; }
+ public virtual DbSet<User> Users { get; set; }
}
}
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
-const string inputFile = @"Model1.edmx";
+const string inputFile = @"Model.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
-// T4 code generation is enabled for model 'c:\users\rafal\documents\visual studio 2015\Projects\Projects\Projects\Models\Model1.edmx'.
+// T4 code generation is enabled for model 'C:\Users\Rafal\Documents\Visual Studio 2015\Projects\Projects\Projects\Models\Model.edmx'.
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
- <Schema Namespace="ProjectsDBModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+ <Schema Namespace="ProjectsDBModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<EntityType Name="Projects">
<Key>
<PropertyRef Name="id" />
<Property Name="task_status_id" Type="int" />
<Property Name="user_id" Type="int" />
</EntityType>
- <EntityType Name="ProjectUsers">
- <Key>
- <PropertyRef Name="id" />
- </Key>
- <Property Name="id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
- <Property Name="login" Type="nvarchar" MaxLength="50" Nullable="false" />
- <Property Name="password" Type="nvarchar" MaxLength="50" Nullable="false" />
- </EntityType>
<EntityType Name="sysdiagrams">
<Key>
<PropertyRef Name="diagram_id" />
</EntityType>
<EntityType Name="TaskStatuses">
<Key>
- <PropertyRef Name="int" />
+ <PropertyRef Name="id" />
</Key>
- <Property Name="int" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+ <Property Name="id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="status" Type="nvarchar" MaxLength="50" />
</EntityType>
+ <EntityType Name="UserRoles">
+ <Key>
+ <PropertyRef Name="id" />
+ </Key>
+ <Property Name="id" Type="int" Nullable="false" />
+ <Property Name="role" Type="nchar" MaxLength="10" Nullable="false" />
+ </EntityType>
+ <EntityType Name="Users">
+ <Key>
+ <PropertyRef Name="id" />
+ </Key>
+ <Property Name="id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+ <Property Name="login" Type="nvarchar" MaxLength="50" Nullable="false" />
+ <Property Name="password" Type="nvarchar" MaxLength="50" Nullable="false" />
+ <Property Name="role_id" Type="int" Nullable="false" />
+ </EntityType>
<Association Name="FK_Projects_Users">
- <End Role="ProjectUsers" Type="Self.ProjectUsers" Multiplicity="0..1" />
+ <End Role="Users" Type="Self.Users" Multiplicity="0..1" />
<End Role="Projects" Type="Self.Projects" Multiplicity="*" />
<ReferentialConstraint>
- <Principal Role="ProjectUsers">
+ <Principal Role="Users">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="Projects">
<End Role="ProjectTasks" Type="Self.ProjectTasks" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="TaskStatuses">
- <PropertyRef Name="int" />
+ <PropertyRef Name="id" />
</Principal>
<Dependent Role="ProjectTasks">
<PropertyRef Name="task_status_id" />
</ReferentialConstraint>
</Association>
<Association Name="FK_Tasks_Users">
- <End Role="ProjectUsers" Type="Self.ProjectUsers" Multiplicity="0..1" />
+ <End Role="Users" Type="Self.Users" Multiplicity="0..1" />
<End Role="ProjectTasks" Type="Self.ProjectTasks" Multiplicity="*" />
<ReferentialConstraint>
- <Principal Role="ProjectUsers">
+ <Principal Role="Users">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="ProjectTasks">
</Dependent>
</ReferentialConstraint>
</Association>
+ <Association Name="FK_Users_UserRoles">
+ <End Role="UserRoles" Type="Self.UserRoles" Multiplicity="1" />
+ <End Role="Users" Type="Self.Users" Multiplicity="*" />
+ <ReferentialConstraint>
+ <Principal Role="UserRoles">
+ <PropertyRef Name="id" />
+ </Principal>
+ <Dependent Role="Users">
+ <PropertyRef Name="role_id" />
+ </Dependent>
+ </ReferentialConstraint>
+ </Association>
<EntityContainer Name="ProjectsDBModelStoreContainer">
<EntitySet Name="Projects" EntityType="Self.Projects" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ProjectTasks" EntityType="Self.ProjectTasks" Schema="dbo" store:Type="Tables" />
- <EntitySet Name="ProjectUsers" EntityType="Self.ProjectUsers" Schema="dbo" store:Type="Tables" />
<EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
<EntitySet Name="TaskStatuses" EntityType="Self.TaskStatuses" Schema="dbo" store:Type="Tables" />
+ <EntitySet Name="UserRoles" EntityType="Self.UserRoles" Schema="dbo" store:Type="Tables" />
+ <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
<AssociationSet Name="FK_Projects_Users" Association="Self.FK_Projects_Users">
- <End Role="ProjectUsers" EntitySet="ProjectUsers" />
+ <End Role="Users" EntitySet="Users" />
<End Role="Projects" EntitySet="Projects" />
</AssociationSet>
<AssociationSet Name="FK_Tasks_Projects" Association="Self.FK_Tasks_Projects">
<End Role="ProjectTasks" EntitySet="ProjectTasks" />
</AssociationSet>
<AssociationSet Name="FK_Tasks_Users" Association="Self.FK_Tasks_Users">
- <End Role="ProjectUsers" EntitySet="ProjectUsers" />
+ <End Role="Users" EntitySet="Users" />
<End Role="ProjectTasks" EntitySet="ProjectTasks" />
</AssociationSet>
+ <AssociationSet Name="FK_Users_UserRoles" Association="Self.FK_Users_UserRoles">
+ <End Role="UserRoles" EntitySet="UserRoles" />
+ <End Role="Users" EntitySet="Users" />
+ </AssociationSet>
</EntityContainer>
- </Schema></edmx:StorageModels>
+ </Schema>
+ </edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="ProjectsDBModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<Property Name="description" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="created_at" Type="DateTime" Precision="7" />
<Property Name="updated_at" Type="DateTime" Precision="7" />
- <NavigationProperty Name="ProjectUser" Relationship="Self.FK_Projects_Users" FromRole="Projects" ToRole="ProjectUsers" />
+ <NavigationProperty Name="User" Relationship="Self.FK_Projects_Users" FromRole="Projects" ToRole="Users" />
<NavigationProperty Name="ProjectTasks" Relationship="Self.FK_Tasks_Projects" FromRole="Projects" ToRole="ProjectTasks" />
</EntityType>
<EntityType Name="ProjectTask">
<Property Name="user_id" Type="Int32" />
<NavigationProperty Name="Project" Relationship="Self.FK_Tasks_Projects" FromRole="ProjectTasks" ToRole="Projects" />
<NavigationProperty Name="TaskStatus" Relationship="Self.FK_Tasks_TaskStatuses" FromRole="ProjectTasks" ToRole="TaskStatuses" />
- <NavigationProperty Name="ProjectUser" Relationship="Self.FK_Tasks_Users" FromRole="ProjectTasks" ToRole="ProjectUsers" />
- </EntityType>
- <EntityType Name="ProjectUser">
- <Key>
- <PropertyRef Name="id" />
- </Key>
- <Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
- <Property Name="login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
- <Property Name="password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
- <NavigationProperty Name="Projects" Relationship="Self.FK_Projects_Users" FromRole="ProjectUsers" ToRole="Projects" />
- <NavigationProperty Name="ProjectTasks" Relationship="Self.FK_Tasks_Users" FromRole="ProjectUsers" ToRole="ProjectTasks" />
+ <NavigationProperty Name="User" Relationship="Self.FK_Tasks_Users" FromRole="ProjectTasks" ToRole="Users" />
</EntityType>
<EntityType Name="sysdiagram">
<Key>
</EntityType>
<EntityType Name="TaskStatus">
<Key>
- <PropertyRef Name="int" />
+ <PropertyRef Name="id" />
</Key>
- <Property Name="int" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+ <Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="status" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<NavigationProperty Name="ProjectTasks" Relationship="Self.FK_Tasks_TaskStatuses" FromRole="TaskStatuses" ToRole="ProjectTasks" />
</EntityType>
+ <EntityType Name="UserRole">
+ <Key>
+ <PropertyRef Name="id" />
+ </Key>
+ <Property Name="id" Type="Int32" Nullable="false" />
+ <Property Name="role" Type="String" MaxLength="10" FixedLength="true" Unicode="true" Nullable="false" />
+ <NavigationProperty Name="Users" Relationship="Self.FK_Users_UserRoles" FromRole="UserRoles" ToRole="Users" />
+ </EntityType>
+ <EntityType Name="User">
+ <Key>
+ <PropertyRef Name="id" />
+ </Key>
+ <Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+ <Property Name="login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+ <Property Name="password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+ <Property Name="role_id" Type="Int32" Nullable="false" />
+ <NavigationProperty Name="Projects" Relationship="Self.FK_Projects_Users" FromRole="Users" ToRole="Projects" />
+ <NavigationProperty Name="ProjectTasks" Relationship="Self.FK_Tasks_Users" FromRole="Users" ToRole="ProjectTasks" />
+ <NavigationProperty Name="UserRole" Relationship="Self.FK_Users_UserRoles" FromRole="Users" ToRole="UserRoles" />
+ </EntityType>
<Association Name="FK_Projects_Users">
- <End Role="ProjectUsers" Type="Self.ProjectUser" Multiplicity="0..1" />
+ <End Role="Users" Type="Self.User" Multiplicity="0..1" />
<End Role="Projects" Type="Self.Project" Multiplicity="*" />
<ReferentialConstraint>
- <Principal Role="ProjectUsers">
+ <Principal Role="Users">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="Projects">
<End Role="ProjectTasks" Type="Self.ProjectTask" Multiplicity="*" />
<ReferentialConstraint>
<Principal Role="TaskStatuses">
- <PropertyRef Name="int" />
+ <PropertyRef Name="id" />
</Principal>
<Dependent Role="ProjectTasks">
<PropertyRef Name="task_status_id" />
</ReferentialConstraint>
</Association>
<Association Name="FK_Tasks_Users">
- <End Role="ProjectUsers" Type="Self.ProjectUser" Multiplicity="0..1" />
+ <End Role="Users" Type="Self.User" Multiplicity="0..1" />
<End Role="ProjectTasks" Type="Self.ProjectTask" Multiplicity="*" />
<ReferentialConstraint>
- <Principal Role="ProjectUsers">
+ <Principal Role="Users">
<PropertyRef Name="id" />
</Principal>
<Dependent Role="ProjectTasks">
</Dependent>
</ReferentialConstraint>
</Association>
+ <Association Name="FK_Users_UserRoles">
+ <End Role="UserRoles" Type="Self.UserRole" Multiplicity="1" />
+ <End Role="Users" Type="Self.User" Multiplicity="*" />
+ <ReferentialConstraint>
+ <Principal Role="UserRoles">
+ <PropertyRef Name="id" />
+ </Principal>
+ <Dependent Role="Users">
+ <PropertyRef Name="role_id" />
+ </Dependent>
+ </ReferentialConstraint>
+ </Association>
<EntityContainer Name="ProjectsDBEntities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="Projects" EntityType="Self.Project" />
<EntitySet Name="ProjectTasks" EntityType="Self.ProjectTask" />
- <EntitySet Name="ProjectUsers" EntityType="Self.ProjectUser" />
<EntitySet Name="sysdiagrams" EntityType="Self.sysdiagram" />
<EntitySet Name="TaskStatuses" EntityType="Self.TaskStatus" />
+ <EntitySet Name="UserRoles" EntityType="Self.UserRole" />
+ <EntitySet Name="Users" EntityType="Self.User" />
<AssociationSet Name="FK_Projects_Users" Association="Self.FK_Projects_Users">
- <End Role="ProjectUsers" EntitySet="ProjectUsers" />
+ <End Role="Users" EntitySet="Users" />
<End Role="Projects" EntitySet="Projects" />
</AssociationSet>
<AssociationSet Name="FK_Tasks_Projects" Association="Self.FK_Tasks_Projects">
<End Role="ProjectTasks" EntitySet="ProjectTasks" />
</AssociationSet>
<AssociationSet Name="FK_Tasks_Users" Association="Self.FK_Tasks_Users">
- <End Role="ProjectUsers" EntitySet="ProjectUsers" />
+ <End Role="Users" EntitySet="Users" />
<End Role="ProjectTasks" EntitySet="ProjectTasks" />
</AssociationSet>
+ <AssociationSet Name="FK_Users_UserRoles" Association="Self.FK_Users_UserRoles">
+ <End Role="UserRoles" EntitySet="UserRoles" />
+ <End Role="Users" EntitySet="Users" />
+ </AssociationSet>
</EntityContainer>
</Schema>
</edmx:ConceptualModels>
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
- <EntitySetMapping Name="ProjectUsers">
- <EntityTypeMapping TypeName="ProjectsDBModel.ProjectUser">
- <MappingFragment StoreEntitySet="ProjectUsers">
- <ScalarProperty Name="id" ColumnName="id" />
- <ScalarProperty Name="login" ColumnName="login" />
- <ScalarProperty Name="password" ColumnName="password" />
- </MappingFragment>
- </EntityTypeMapping>
- </EntitySetMapping>
<EntitySetMapping Name="sysdiagrams">
<EntityTypeMapping TypeName="ProjectsDBModel.sysdiagram">
<MappingFragment StoreEntitySet="sysdiagrams">
<EntitySetMapping Name="TaskStatuses">
<EntityTypeMapping TypeName="ProjectsDBModel.TaskStatus">
<MappingFragment StoreEntitySet="TaskStatuses">
- <ScalarProperty Name="int" ColumnName="int" />
+ <ScalarProperty Name="id" ColumnName="id" />
<ScalarProperty Name="status" ColumnName="status" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
+ <EntitySetMapping Name="UserRoles">
+ <EntityTypeMapping TypeName="ProjectsDBModel.UserRole">
+ <MappingFragment StoreEntitySet="UserRoles">
+ <ScalarProperty Name="id" ColumnName="id" />
+ <ScalarProperty Name="role" ColumnName="role" />
+ </MappingFragment>
+ </EntityTypeMapping>
+ </EntitySetMapping>
+ <EntitySetMapping Name="Users">
+ <EntityTypeMapping TypeName="ProjectsDBModel.User">
+ <MappingFragment StoreEntitySet="Users">
+ <ScalarProperty Name="id" ColumnName="id" />
+ <ScalarProperty Name="login" ColumnName="login" />
+ <ScalarProperty Name="password" ColumnName="password" />
+ <ScalarProperty Name="role_id" ColumnName="role_id" />
+ </MappingFragment>
+ </EntityTypeMapping>
+ </EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
- <Diagram DiagramId="8eea6ea450c84400b6b16899211fcd8a" Name="Diagram1">
- <EntityTypeShape EntityType="ProjectsDBModel.Project" Width="1.5" PointX="3" PointY="1.25" IsExpanded="true" />
- <EntityTypeShape EntityType="ProjectsDBModel.ProjectTask" Width="1.5" PointX="5.25" PointY="1" IsExpanded="true" />
- <EntityTypeShape EntityType="ProjectsDBModel.ProjectUser" Width="1.5" PointX="0.75" PointY="1.5" IsExpanded="true" />
- <EntityTypeShape EntityType="ProjectsDBModel.sysdiagram" Width="1.5" PointX="5.75" PointY="4.75" IsExpanded="true" />
- <EntityTypeShape EntityType="ProjectsDBModel.TaskStatus" Width="1.5" PointX="3" PointY="5.625" IsExpanded="true" />
+ <Diagram DiagramId="fb52aa34f4b64f1489c1c8e9f3269c72" Name="Diagram1">
+ <EntityTypeShape EntityType="ProjectsDBModel.Project" Width="1.5" PointX="5.25" PointY="1.25" IsExpanded="true" />
+ <EntityTypeShape EntityType="ProjectsDBModel.ProjectTask" Width="1.5" PointX="7.5" PointY="1" IsExpanded="true" />
+ <EntityTypeShape EntityType="ProjectsDBModel.sysdiagram" Width="1.5" PointX="0.75" PointY="4.75" IsExpanded="true" />
+ <EntityTypeShape EntityType="ProjectsDBModel.TaskStatus" Width="1.5" PointX="5.25" PointY="5.625" IsExpanded="true" />
+ <EntityTypeShape EntityType="ProjectsDBModel.UserRole" Width="1.5" PointX="0.75" PointY="1.625" IsExpanded="true" />
+ <EntityTypeShape EntityType="ProjectsDBModel.User" Width="1.5" PointX="3" PointY="1.25" IsExpanded="true" />
<AssociationConnector Association="ProjectsDBModel.FK_Projects_Users" ManuallyRouted="false" />
<AssociationConnector Association="ProjectsDBModel.FK_Tasks_Projects" ManuallyRouted="false" />
<AssociationConnector Association="ProjectsDBModel.FK_Tasks_TaskStatuses" ManuallyRouted="false" />
<AssociationConnector Association="ProjectsDBModel.FK_Tasks_Users" ManuallyRouted="false" />
+ <AssociationConnector Association="ProjectsDBModel.FK_Users_UserRoles" ManuallyRouted="false" />
</Diagram>
</edmx:Diagrams>
</edmx:Designer>
<#@ include file="EF6.Utility.CS.ttinclude"#><#@
output extension=".cs"#><#
-const string inputFile = @"Model1.edmx";
+const string inputFile = @"Model.edmx";
var textTransform = DynamicTextTransformation.Create(this);
var code = new CodeGenerationTools(this);
var ef = new MetadataTools(this);
{
}
- [MetadataType(typeof(ProjectUserMetadata))]
- public partial class ProjectUser
+ [MetadataType(typeof(UserMetadata))]
+ public partial class User
{
}
public Nullable<System.DateTime> created_at { get; set; }
public Nullable<System.DateTime> updated_at { get; set; }
- public virtual ProjectUser ProjectUser { get; set; }
+ public virtual User User { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<ProjectTask> ProjectTasks { get; set; }
}
public virtual Project Project { get; set; }
public virtual TaskStatus TaskStatus { get; set; }
- public virtual ProjectUser ProjectUser { get; set; }
+ public virtual User User { get; set; }
}
}
this.ProjectTasks = new HashSet<ProjectTask>();
}
- public int @int { get; set; }
+ public int id { get; set; }
public string status { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
using System;
using System.Collections.Generic;
- public partial class ProjectUser
+ public partial class User
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
- public ProjectUser()
+ public User()
{
this.Projects = new HashSet<Project>();
this.ProjectTasks = new HashSet<ProjectTask>();
public int id { get; set; }
public string login { get; set; }
public string password { get; set; }
+ public int role_id { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Project> Projects { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<ProjectTask> ProjectTasks { get; set; }
+ public virtual UserRole UserRole { get; set; }
}
}
--- /dev/null
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated from a template.
+//
+// Manual changes to this file may cause unexpected behavior in your application.
+// Manual changes to this file will be overwritten if the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Projects.Models
+{
+ using System;
+ using System.Collections.Generic;
+
+ public partial class UserRole
+ {
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+ public UserRole()
+ {
+ this.Users = new HashSet<User>();
+ }
+
+ public int id { get; set; }
+ public string role { get; set; }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+ public virtual ICollection<User> Users { get; set; }
+ }
+}
<Compile Include="Models\IdentityModels.cs" />
<Compile Include="Models\ManageViewModels.cs" />
<Compile Include="Models\Metadata.cs" />
- <Compile Include="Models\Model1.Context.cs">
+ <Compile Include="Models\Model.Context.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
- <DependentUpon>Model1.Context.tt</DependentUpon>
+ <DependentUpon>Model.Context.tt</DependentUpon>
</Compile>
- <Compile Include="Models\Model1.cs">
+ <Compile Include="Models\Model.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
- <DependentUpon>Model1.tt</DependentUpon>
+ <DependentUpon>Model.tt</DependentUpon>
</Compile>
- <Compile Include="Models\Model1.Designer.cs">
+ <Compile Include="Models\Model.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
- <DependentUpon>Model1.edmx</DependentUpon>
+ <DependentUpon>Model.edmx</DependentUpon>
</Compile>
<Compile Include="Models\PartialClasses.cs" />
+ <Compile Include="Controllers\ProjectsController.cs" />
<Compile Include="Models\Project.cs">
- <DependentUpon>Model1.tt</DependentUpon>
+ <DependentUpon>Model.tt</DependentUpon>
</Compile>
- <Compile Include="Controllers\ProjectsController.cs" />
<Compile Include="Models\ProjectTask.cs">
- <DependentUpon>Model1.tt</DependentUpon>
- </Compile>
- <Compile Include="Models\ProjectUser.cs">
- <DependentUpon>Model1.tt</DependentUpon>
+ <DependentUpon>Model.tt</DependentUpon>
</Compile>
<Compile Include="Models\sysdiagram.cs">
- <DependentUpon>Model1.tt</DependentUpon>
+ <DependentUpon>Model.tt</DependentUpon>
</Compile>
<Compile Include="Models\TaskStatus.cs">
- <DependentUpon>Model1.tt</DependentUpon>
+ <DependentUpon>Model.tt</DependentUpon>
+ </Compile>
+ <Compile Include="Models\User.cs">
+ <DependentUpon>Model.tt</DependentUpon>
+ </Compile>
+ <Compile Include="Models\UserRole.cs">
+ <DependentUpon>Model.tt</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Startup.cs" />
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Content\Site.css" />
- <Content Include="Models\Model1.Context.tt">
+ <Content Include="Models\Model.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
- <DependentUpon>Model1.edmx</DependentUpon>
- <LastGenOutput>Model1.Context.cs</LastGenOutput>
+ <DependentUpon>Model.edmx</DependentUpon>
+ <LastGenOutput>Model.Context.cs</LastGenOutput>
</Content>
- <Content Include="Models\Model1.tt">
+ <Content Include="Models\Model.tt">
<Generator>TextTemplatingFileGenerator</Generator>
- <DependentUpon>Model1.edmx</DependentUpon>
- <LastGenOutput>Model1.cs</LastGenOutput>
+ <DependentUpon>Model.edmx</DependentUpon>
+ <LastGenOutput>Model.cs</LastGenOutput>
</Content>
<Content Include="Scripts\ai.0.15.0-build58334.js" />
<Content Include="Scripts\ai.0.15.0-build58334.min.js" />
<Content Include="ApplicationInsights.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <EntityDeploy Include="Models\Model1.edmx">
+ <EntityDeploy Include="Models\Model.edmx">
<Generator>EntityModelCodeGenerator</Generator>
- <LastGenOutput>Model1.Designer.cs</LastGenOutput>
+ <LastGenOutput>Model.Designer.cs</LastGenOutput>
</EntityDeploy>
- <Content Include="Models\Model1.edmx.diagram">
- <DependentUpon>Model1.edmx</DependentUpon>
+ <Content Include="Models\Model.edmx.diagram">
+ <DependentUpon>Model.edmx</DependentUpon>
</Content>
<None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\jquery-1.10.2.js" />
</dd>
<dt>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</dt>
<dd>
- @Html.DisplayFor(model => model.ProjectUser.login)
+ @Html.DisplayFor(model => model.User.login)
</dd>
</dl>
</dd>
<dt>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</dt>
<dd>
- @Html.DisplayFor(model => model.ProjectUser.login)
+ @Html.DisplayFor(model => model.User.login)
</dd>
</dl>
@Html.DisplayNameFor(model => model.TaskStatus.status)
</th>
<th>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</th>
<th></th>
</tr>
@Html.DisplayFor(modelItem => item.TaskStatus.status)
</td>
<td>
- @Html.DisplayFor(modelItem => item.ProjectUser.login)
+ @Html.DisplayFor(modelItem => item.User.login)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.id }) |
</dd>
<dt>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</dt>
<dd>
- @Html.DisplayFor(model => model.ProjectUser.login)
+ @Html.DisplayFor(model => model.User.login)
</dd>
</dl>
</dd>
<dt>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</dt>
<dd>
- @Html.DisplayFor(model => model.ProjectUser.login)
+ @Html.DisplayFor(model => model.User.login)
</dd>
</dl>
@Html.DisplayNameFor(model => model.updated_at)
</th>
<th>
- @Html.DisplayNameFor(model => model.ProjectUser.login)
+ @Html.DisplayNameFor(model => model.User.login)
</th>
<th></th>
</tr>
@Html.DisplayFor(modelItem => item.updated_at)
</td>
<td>
- @Html.DisplayFor(modelItem => item.ProjectUser.login)
+ @Html.DisplayFor(modelItem => item.User.login)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.id }) |
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Projects-20160211114506.mdf;Initial Catalog=aspnet-Projects-20160211114506;Integrated Security=True" providerName="System.Data.SqlClient" />
- <add name="ProjectsDBEntities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=RAFAL-PC\SQLEXPRESS;initial catalog=ProjectsDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
- </connectionStrings>
+ <add name="ProjectsDBEntities" connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=RAFAL-PC\SQLEXPRESS;initial catalog=ProjectsDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />