public void Create(DalRole e)
 {
     var role = new Role()
     {
         Name = e.Name
     };
     context.Set<Role>().Add(role);
 }
Example #2
0
 public void Create(DalRole entity)
 {
     Role role = new Role()
     {
         Name = entity.Name,
     };
     _context.Set<Role>().Add(role);
 }
 public void Create(DalRole entity)
 {
     var role = new Role()
     {
         RoleName = entity.RoleName
     };
     _dbContext.Set<Role>().Add(role);
 }
 private DalRole ConvertToDalRoleFromOrmRole(Role ormrole)
 {
     return new DalRole()
     {
         Id = ormrole.Id,
         Name = ormrole.Name
     };
 }
Example #5
0
 public void Update(DalRole entity)
 {
     Role role = new Role()
     {
         Id = entity.Id,
         Name = entity.Name
     };
     _context.Set<Role>().AddOrUpdate(role);
 }
Example #6
0
 public void Delete(DalRole entity)
 {
     Role role = new Role()
     {
         Id = entity.Id,
         Name = entity.Name
     };
     role = _context.Set<Role>().Single(r => r.Id == role.Id);
     _context.Set<Role>().Remove(role);
 }
 public void Update(DalRole e)
 {
     var role = new Role()
     {
         RoleId = e.Id,
         Name = e.Name
     };
     role = context.Set<Role>().Single(r => r.RoleId == role.RoleId);
     context.Entry(role).State = System.Data.Entity.EntityState.Modified;
 }
 public void Delete(DalRole e)
 {
     var role = new Role()
     {
         RoleId = e.Id,
         Name = e.Name
     };
     role = context.Set<Role>().Single(r => r.RoleId == role.RoleId);
     context.Set<Role>().Remove(role);
 }
Example #9
0
 public static Role ToModel(this DalRoleEntity item)
 {
     if (item == null)
         return null;
     Role roleEntity = new Role
     {
         Id = item.Id,
         Name = item.Name
     };
     return roleEntity;
 }
Example #10
0
 public static void CopyFieldsTo(this DalRole source, Role target)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     target.Name = source.Name;
 }
 public void Delete(DalRole entity)
 {
     var role = new Role()
     {
         RoleId = entity.Id,
         RoleName = entity.RoleName
     };
     role = _dbContext.Set<Role>().Single(r => r.RoleId == role.RoleId);
     if (role == null)
     {
         return;
     }
     _dbContext.Set<Role>().Remove(role);
 }
Example #12
0
 public override void CreateRole(string roleName)
 {
     var role = new Role { Name = roleName };
     RoleService.Add(role);
 }