public int Create(RoleEntity role)
        {
            CatchMeContext.Roles.Add(role);
            CatchMeContext.SaveChanges();

            return role.Id;
        }
        public void Delete(RoleEntity role)
        {
            var parameters = new[]
            {
                new SqlParameter(SpParams.RoleCommon.RoleId, role.Name) { Direction = ParameterDirection.Input, DbType = DbType.Int32 }
            };

            ExecuteNonQueryProc(SpNames.DeleteRoleById, parameters);
        }
        public void Update(RoleEntity role)
        {
            var roleToUpdate = CatchMeContext.Roles.Find(role.Id);

            if (roleToUpdate != null)
            {
                roleToUpdate.Name = role.Name;
                CatchMeContext.SaveChanges();
            }
        }
        public int Create(RoleEntity role)
        {
            var parameters = new[]
            {
                new SqlParameter(SpParams.RoleCommon.RoleName, role.Name) { Direction = ParameterDirection.Input, DbType = DbType.String }
            };

            var roleId = ExecuteScalar(SpNames.AddRole, parameters);

            return roleId;
        }
 public void Delete(RoleEntity role)
 {
     CatchMeContext.Roles.Remove(role);
     CatchMeContext.SaveChanges();
 }
        public RoleEntity PopulateRoleEntity(SqlDataReader reader)
        {
            var role = new RoleEntity()
            {
                Id = reader["RoleId"].FromDb<int>(),
                Name = reader["RoleName"].FromDb<string>(),
            };

            return role;
        }